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 -- I do things for love or money --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
you want a before filter http://api.rubyonrails.org/classes/ActionController/Filters/ClassMethods.html On 9/7/06, Dorian Mcfarland <loaf-1pY2Ax6usr8dnm+yROfE0A@public.gmane.org> wrote:> > 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 > > -- > I do things for love or money > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---