Answer the question
In order to leave comments, you need to log in
Rails, what's the easiest way to refactor logic from controllers to models?
In the current project, models were used mainly for validating input data and scopes for filters.
All logic was written in controllers! this is bad(
What is the fastest and easiest way to transfer logic from controllers to a model.
I read books for beginners where everything is said about logic in models.
Where can I read about transferring logic to models.
Something simple is desirable.
Answer the question
In order to leave comments, you need to log in
The latest fashion trends offer logic to endure in the so-called. service objects. See: 1 , 2 , 3 , etc.
The easiest way is by hand. You take logic and transfer what is not clear here? The same code with some nuances (for example, inaccessible current_user from the device in models).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question