On Nov 28, 3:37 am, Abhishek shukla
<bettera...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hello Friends,
>
> I have a requirement where I want to Have the following url
"http://www.example.com/*andy.something*/office" where *andy.something
is a
> dynamic value.
>
> *Now I am using a namespace which is
> :controller=>"system/office/office_profiles"
>
> and I have declared the route
>
> map.office_profile_link ''/:profile_link/office'',
:controller =>
Are you sure you want "_link" as part of the route name? Remember the
*_url and *_path helpers are generated from your existing named
routes. But thats not the issue at hand.
> "system/office/office_profiles", :action => "show",
:conditions => { :method
> => :get }
>
> But when I am trying to access
>
> http://www.example.com/*andy.something*/office
>
> Getting the following error
>
> Routing Error
>
> No route matches "/andy.something/office" with {:method=>:get}
>
> So Please let me know where I am getting wrong.
>
> Thanks
> Abhis.
You''re not doing anything necessarily wrong; Rails just automatically
delimits bound parameters on periods. Tell the route to expect a "."
in the :name parameter by adding a requirement (http://
guides.rubyonrails.org/routing.html#route-requirements) to the route
like
map.office_profile_link ''/:profile_link/office'', :controller
=>
"system/office/office_profiles", :action => "show",
:conditions =>
{ :method => :get }, :name => /(?:\w+)(?:\.\w+)?/ # of course using an
appropriate regex for your cause
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.