Dynamic routes from the url? is this even possible?

my quesion is…what is available to routes.rb that it creates the
values of the symbols you define in the rules? what i mean by this is,
is there a named variable that contains the url sent in the request
that i can get at to force values into my rules?
i’m trying to do the following:

i have a url… www.my_domain.com/abc/blogentry/show/1
and the rule… map.connect ‘:site_code/:controller/:action/:id’
nothing strange about that, sure. but what i want is for :controller
not to be ‘blogentry’ but to be ‘sites/blogentry’ (within the
‘controllers’ folder i have two named folders: ‘sites’ and ‘admin’ so
i want to do something like this:

map.connect ‘:site_code/:controller/:action/:id’, :controller =>
‘sites/#{SOMETHING_FROM_THE_URL_THAT_IS_THE_CONTROLLER}’

the ‘admin’ side is taken care of, the url would be…
www.my_domain.com/admin/blogentry/edit/1
and the rule…
map.connect ‘:controller/:action/:id’, :requirements => { :controller
=> /admin[/]?[\w\d]*/ }

i’m fine with creating a regex pattern match to get the correct value
out…i just just don’t know from where i can get at it.

any ideas?? (this is starting to drive me slowly crazy :s)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs