Hello, this have been debated few times in the forum but I didn’t found
a satisfying solution : my problem is very simple, I have few methods
dealing with cookies that are intended to be used in controllers and
views.
Let say I have the read_cookie() method. Because it deals with the
response object putting this method in the /lib directory doesn’t fit
nicely because I would need to pass the object method to each call to
read_cookie, as in read_cookie(response)
If I put read_cookie in a application helper, I can’t use it in the
controller and if I put it in the application.rb file I can’t use it
from the view
So, I’m quite sure there is an elegant solution provided by RoR as
usual… But which one ?
Hello, this have been debated few times in the forum but I didn’t found
a satisfying solution : my problem is very simple, I have few methods
dealing with cookies that are intended to be used in controllers and
views.
Let say I have the read_cookie() method. Because it deals with the
response object putting this method in the /lib directory doesn’t fit
nicely because I would need to pass the object method to each call to
read_cookie, as in read_cookie(response)
If I put read_cookie in a application helper, I can’t use it in the
controller and if I put it in the application.rb file I can’t use it
from the view
So, I’m quite sure there is an elegant solution provided by RoR as
usual… But which one ?
Thanks
I mean “I will need to pass the response object to every call to
read_cookie or write_cookie” (in the case I use /lib)