setting default session variables

Hi there, I'm trying to use a session variable to keep (some of) a set of collapsible tags open. everything works fine once I have my session[:opentags] set to something, but obviously the variable doesn't exist by default, only when I first set it.

Is there a good place for me to write something like session[:opentags] ||= "", such that it would be available to every request?

I tried doing it in an 'initialize' method in application controller, but session doesn't seem to have been set up at that point.

thanks

dorian

you want a before filter

http://api.rubyonrails.org/classes/ActionController/Filters/ClassMethods.html

Hi Dorian

Is there a good place for me to write something like session[:opentags] ||= “”, such that it would be available to every request?

I’m defining a before_filter in application.rb for that kind of purpose.

hth

Thibaut