Hi all, One of my routes looks like this: map.connect '':blog/:controller/:action/:id'' The :blog should actualy become a session variable (indication who''s blog it is). eg url: www.site.com/railsblog/posts/ I want to set a session variable to ''railsblog''. Is this possible? If yes, how do I do this? Thanks in advance Stijn --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
In your example, params[:blog] has the value ''railsblog'', so you could do session[:blog] = params[:blog] to set a session variable with that value. -- Building an e-commerce site with Rails? http://agilewebdevelopment.com/rails-ecommerce Meet up at RailsConf: http://railsconf2007.conferencemeetup.com/ On May 21, 2007, at 8:20 AM, Tarscher wrote:> > Hi all, > > One of my routes looks like this: map.connect > '':blog/:controller/:action/:id'' > > The :blog should actualy become a session variable (indication who''s > blog it is). eg url: www.site.com/railsblog/posts/ I want to set a > session variable to ''railsblog''. Is this possible? If yes, how do I do > this? > > Thanks in advance > Stijn >--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
With every request I should set that blog parameter to the session variable. I tried to add session[:blog] = params[:blog] in the ApplicationController but this doesn''t work (''We''re sorry, but something went wrong.''). Isn''t the AppliationController always called and isn''t it thus the perfect place to set that session variable? Thanks in advance Stijn On 21 mei, 18:58, Benjamin Curtis <r...-4dtGyw5agdmakBO8gow8eQ@public.gmane.org> wrote:> In your example, params[:blog] has the value ''railsblog'', so you > could do session[:blog] = params[:blog] to set a session variable > with that value. > > -- > Building an e-commerce site with Rails?http://agilewebdevelopment.com/rails-ecommerce > > Meet up at RailsConf:http://railsconf2007.conferencemeetup.com/ > > On May 21, 2007, at 8:20 AM,Tarscherwrote: > > > > > Hi all, > > > One of my routes looks like this: map.connect > > '':blog/:controller/:action/:id'' > > > The :blog should actualy become a session variable (indication who''s > > blog it is). eg url:www.site.com/railsblog/posts/I want to set a > > session variable to ''railsblog''. Is this possible? If yes, how do I do > > this? > > > Thanks in advance > > Stijn--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---