I
I
IvanN7772016-05-13 15:21:59
Ruby on Rails
IvanN777, 2016-05-13 15:21:59

Linked part of the code into a method. but it has a session, that is, it is impossible in Model, in Helper? or can be somehow more orthodox?

That is, purely in the controller, I don’t want to keep it as many lines of code and it contains redis, but there are sessions there and it doesn’t allow it into the model.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DarkSideF, 2016-06-08
@IvanN777

In my opinion, the most adequate solution is to pass the session as a parameter to the model method.
If only a specific value from the session is used, it is better to pass it, rather than the entire session.
And, if you then need to change this value in the session to a new one, you should return it from the model method to the controller and assign it in the controller.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question