I
I
IvanN7772015-01-10 12:52:28
Ruby on Rails
IvanN777, 2015-01-10 12:52:28

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

2 answer(s)
V
vsuhachev, 2015-01-10
@IvanN777

The latest fashion trends offer logic to endure in the so-called. service objects. See: 1 , 2 , 3 , etc.

E
Eugene Burmakin, 2015-01-10
@Freika

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 question

Ask a Question

731 491 924 answers to any question