
Rails hurts…
Rails itself doesn't do anything to help programmers organize code in large applications.
If you don't do anything as well, you're screwed up - everything gets intertangled and fragile. The development process, previously agile, becomes clunky.
…but we're aware!
Most of us aware of the problem and take actions to resist:
- We have empirically figured out that certain features of Rails should be avoided, but we're not sure why are they so harmful
- We keep our controllers skinny, although our models often become junk drawers :(
- We read about SOLID and design patterns, but it is not clear if they are applicable to Ruby and Rails at all
- We look for salvation in OOP. Assuming we don't know it enough, we read books from recognized gurus of the industry, but our resulting solutions appear to be bulky and not as beautiful, as we expected
- We introduce additional abstractions, but they result in overhead, and, often, even in more complicated code
The worst is that everyone has a different approach. Therefore, where you expect to see a more or less unified approach, everyone comes up with its own solution.
Rails community is like ancient Babylon – everyone speaks its own language
This contradicts the central idea of engineering - to develop a single optimal solution for every problem, and to stick to it.
What if there is a simple consistent approach which solves the major problems of Rails application growth, and it brings almost no overhead?
Painless Rails approach
I write a book called "Painless Rails", where I describe such an approach. It has some quite interesting characteristics:
- It doesn't fight against Rails
- It brings very little overhead
- It uses Rails conventions
- It doesn't rely on a programmer's discipline
- The joy of development using this approach is comparable to the joy of first two weeks with vanilla Rails
- It doesn't simply patches the Rails Way, but rather provides a conceptual upgrade to it
This book is here to help you achieve these things:
- Identify and fix most harmful flaws in your current Rails application
- Establish a solid foundation for your next Rails project
- Learn to look beyond code and realize how to organize concepts, not classes and methods
The roots of the Painless Rails approach
The author of the approach described in the book is Kirill Mokevnin - CTO of Hexlet.io -
a major online-learning platform for programmers (not only) in Russia.

Their platform is a six years old Rails application with:
- more than 300 models
- ~100 associations in the User model
- ~700 routes
- ~50K lines of Ruby code
- user base: 165000 learners
Kirill has managed to develop an efficient approach to web development using Rails,
so that through the whole life of the project there were only 1-2 active developers.
I learned about that approach three months ago. The most enchanting discovery for me was that
you don't have to fight against the framework. Even if you're introducing additional abstractions.
I was so impressed that I decided to share it with those who love Rails but are not satisfied with what it suggests out of the box today.
Table of contents*
Chapter 1: Controversial smoothness of Rails way approach
- Masking complexity with callbacks and conditional validations
- Mixing internal with external
- Ignoring layers in Rails
- Mixing Application Logic and Business Logic
- The time-bomb effect
Chapter 2: Painless Rails foundation
- Shapes
- Services
- Mutators
- Repositories
- Domain Models
Chapter 3: Painless Rails frame
- Hierarchy of models
- The key part of REST
- Hierarchy of controllers
- Testing
- Service Locator
Chapter 4: Painless Rails approach in practice
* The book structure and titles might differ in the final version
Who is this book for?
- You know that vanilla Rails is not enough for big projects
- You have tried multiple alternaive approaches
- You are still not happy with what you get
If all of the above applies to you, then you will not regret buying this book.
Get it now:
The price is $29, but it will go up, once more content is added.
If you buy now, you get all the future updates of course.
Buy the book
This is prerelease, although the book is already doing its job pretty well.
What do I get?
- The work-in-progress version of the book (~45 pages in PDF format), containing first three chapters.
- Also, if you understand Russian, you get a bonus of 16 screencasts (2.5 hours) with Painless Rails approach description
- Access to private Telegram chat where you can ask questions about the approach
- All future updates
Expected outcomes
This book is going to help you to:
- understand the real meaning of Rails Way code, and its negative effects
- separate business logic from application logic
- line up the hierarchy of models and controllers
- start using lightweight services to describe business scenarios
- turn your models into Domain Models
- distinguish harmful gems from harmless
- isolate harmful gems effects if you want to keep using them
- recognize and avoid harmful Rails features and conventional techniques
- learn how to write cheap but efficient tests
Samples

Meet the author: Ivan Nemytchenko
- Has 15 years of experience in Web applications development
- Rails applications architecture explorer
- Occasional speaker and teacher
- Former GitLab developer advocate
Still in doubts?