> Can I specify a url ie
> http://localhost/AccountName/:contorller/:action/:id
>
> Where AccountName is should be a userName, which will lookup a siteId in
> the database?
Yo!
you can specify the following routes...
map.connect '':user_name/:controller/:action/:id''
map.connect '':controller/:action/:id''
Then in ApplicationController
before_filter :set_site_id
def set_site_id
u = User.find_by_user_name params[:user_name]
params[:site_id] = u ? u.site_id : nil
return true
end
Then in your actions,
def some_action
@site = Site.find(params[:site_id])
end
Hope this helps...
Also, if you''re only going to use this route in a specific controller,
put the before_filter and accompanying action in it, instead of in the
application_controller, where it will be run before every request, not
just those run on the desired controller.
Ciao!
gustav@rails.co.za
Gustav Paul
itsdEx.com
--
Posted via http://www.ruby-forum.com/.