Denix wrote:> I want such urls in at site:
> http://mysite.com/freddy/profile/view
> http://mysite.com/freddy/blog/view
> ....
> so I want username in my url, and it should use controllers from
> folder: member
>
> And I use this route:
> <pre>
> map.username ":username/:controller/:action/:id",
> :controller => ''member/:controller'',
> :action => '':action'',
> :id => '':id'',
> :requirements => { :username => /[a-zA-Z0-9_]+/}
> </pre>
>
> But it gives me error: "wrong constant name
:controllerController".
>
> What''s wrong?
Hey Denix,
Here is an example from the rails api regarding "Regular Expressions and
Parameters":
map.geocode ''geocode/:postalcode'', :controller =>
''geocode'',
:action => ''show'', :postalcode =>
/\d{5}(-\d{4})?/
Kind of similar to your example, no? If I were to re-write your write,
it might look *something* like this:
map.username ":username/:controller/:action",
:controller => ''member'',
:action => ''show'',
:requirements => { :username => /[a-zA-Z0-9_]+/}
Hope this helps a bit, read more about routing here:
http://api.rubyonrails.org/classes/ActionController/Routing.html
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---