Marcus Mitchell
2006-Jul-11 10:47 UTC
[Rails] 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) -- Posted via http://www.ruby-forum.com/.
Maybe Matching Threads
- URL issue localhost/mongrel vs remote-server/apache
- quesion about SS of ANOVA
- Re: Using virsh blockcopy -- what's it supposed to accomplish?
- Re: Using virsh blockcopy -- what's it supposed to accomplish?
- How change text_area form helper into rich text entry area/control?