setting variable via url

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

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.

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