Routing error.

0 views
Skip to first unread message

abhishek shukla

unread,
Nov 28, 2009, 4:42:00 AM11/28/09
to bangal...@googlegroups.com
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 => "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.

--
Thanks & Regards,
Abhishek P Shukla
Mobile: 91-9879995401
Mail: shukla.a...@gmail.com

Pratik

unread,
Nov 28, 2009, 5:26:43 AM11/28/09
to bangal...@googlegroups.com
You'll need to add a :requirements parameter to the route :

map.office_profile_link '/:profile_link/office', :controller =>
"system/office/office_profiles", :action => "show", :requirements =>
{:profile_link => /[\w\.]+/}
--
Cheers!
- Pratik
http://m.onkey.org | http://twitter.com/lifo

abhishek shukla

unread,
Nov 28, 2009, 10:11:34 PM11/28/09
to bangal...@googlegroups.com
Hey Pratik,

Thanks a ton, You saved my life ;). That worked very well.

Thanks
Abhishek Shukla
Reply all
Reply to author
Forward
0 new messages