Hi
I would like to have variable visible for all actions of one
controller. It's something like admin panel where I have some actions,
such as 'list', 'new', 'edit' and I have to display at the top of the
page logged user's name.
How and where do I have to declare and assign variable like this?
I would like to not use additional plugins to do that.
It works on sessions, of course, and I know that I can put user_name
in session but I would like to keep only user_id and read other
information from database. But I don't want to do something like:
@user_name = User.find_by_id(session[:user_id])
in every action. I would like to do that once per controller and use
it in all views available for these actions.
Is it correct and possible?