Topic: Where to put this helper routine?.
I have some helper routines for setting session data.
session[:user_id] = user.id
def updaterecentitems(type, id)
session[:r0type] = type
session[:r0id] = id
Im having a hard time figuring out where to put it so I can use it from many different places.
The first place I want to use it is when a user logs in. But, I will also want to use it from different controllers so that I can keep track of 'recent items'.
If I put it in my LoginController, it works at login, but I dont know if Ill be able to use it elsewhere.
Ive tried putting it in the login_helper - but it doesnt 'see' it from the controller. I think the helpers are only accessable from the views, right? Similarly, Ive tried putting it in to the application_helper, but the same thing happens.
Finally, Ive tried putting it in to various models, but they dont have access to the 'session' hash.
Should I just put it in one of the controllers? Will other controllers be able to access it? (Like LoginController.updaterecentitems or something like that?)