JavaScript for Rails Developers
Make JavaScript your second-favorite language
by Rails DesignerFor decades Ruby on Rails devs have shrugged at JavaScript, cursed at it or vowed to never use it again. But over the years, JavaScript has improved greatly. And if you want to write modern (SaaS) web apps today, there is simply no way around it.
Sure, the Hotwire tools help you tremendously to write as little JavaScript as possible, but if you want something a bit more bespoke, you need to write some JavaScript (preferably using Stimulus) by hand.
This short and focused book will help you, Ruby on Rails developer, become more comfortable writing your own JavaScript and understand the JavaScript written by others. It won't be about React or Vue (or any of the other thousands available JS frameworks), but about writing and understand JavaScript in the Hotwire-way.
The idea is to go from zero to a functional code editor in your Rails app throughout various, easy to digest chapters. This will cover everything from working with a dependency in Stimulus, to extracting logic in smaller classes, refactoring to be more readable and using more advanced features like promises.
If you have been a Rails developer who has cursed at JavaScript, this book might be for you. If you've been a Rails developer avoiding JavaScript at all costs, this book is what you need. For Rails developers who've wished JavaScript would just disappear, this book might change your mind.
Pre-order Today — $30 (40% off)
Table of Contents
This is the tentative table of contents. Let me know if you want to see a specific subject.
-
Introduction
- Foreword by …
- Why you want to use JavaScript
- Overview of JavaScript Evolution (it really is pretty good!)
-
When You Do Not Need JavaScript
- When CSS is enough
- Balancing Between Server-Side and Client-Side Logic
-
DOM Manipulation
- Basics of the Document Object Model
- Select and Modify Elements with JavaScript
- Event Handling and Listeners
-
Essentials
- Understanding JavaScript Syntax and Features
- Variables, Functions, and Scope
- ES6+ Features: Let, Const, Arrow Functions, and More
-
Advanced JavaScript
- Asynchronous JavaScript: Callbacks, Promises, and Async/Await
- JavaScript Modules and Imports
- Error Handling and Debugging
-
JavaScript and Stimulus
- What is Stimulus
- Beyond The Basic Examples
- Stimulus Best Practices
- Conclusion
FAQ
When will the book be published?
At this point there is the outline and only a few chapters written. My aim is early 2025. Based on the feedback it will be earlier or later.
Is the book for beginners?
Yes, and no. If you are a Rails veteran but always steered away from JavaScript, this book might just be for you. If you are just starting out with Rails, I would recommend to focus on Ruby (and Rails) first, and then come back to buy this book.
Anything I can read or preview?
Nothing from the book yet, but if you are curious about my writing around JavaScript and front-end code, check out these articles from Rails Designer.
Is there bulk/team pricing?
Yes, if you want to read the book twice as fast, you can buy two copies. Or if you want to buy copies for your whole team, reach out for a volume discount code (starting at 5 copies).
How will the book be published?
Plan is to distribute digitally for the common formats (HTML, PDF and e-book formats).