If ".com" becomes part of the URL, Routing error is flashed

Hi,

I am trying to list companies in a catalog. I have set following route
for that

map.connect ‘company/:company’
:controller => ‘community’,
:action => ‘search’

Now I have “.com” as a part of the company name(Amazon.com), then my app
flags out an error stating:
no route found to match “/company-profile/amazon.com” with
{:method=>:get})

How can i avoid this?

Regards,
SG

On Fri, Jul 25, 2008 at 14:57, Sandeep G.
[email protected] wrote:

Now I have “.com” as a part of the company name(Amazon.com), then my app
flags out an error stating:
no route found to match “/company-profile/amazon.com” with
{:method=>:get})

How can i avoid this?

Just specify a catchall condition on the parameter :

map.connect ‘company/:company’, :controller => ‘community’, :action =>
‘search’, :company => /.*/

PS: this mailing list is almost french oriented :wink:


http://fabien.jakimowicz.com

As long as some like you is there, I don’t mind at all :):slight_smile:
Thanks a lot. This works.

Fabien J. wrote:

On Fri, Jul 25, 2008 at 14:57, Sandeep G.
[email protected] wrote:

Now I have “.com” as a part of the company name(Amazon.com), then my app
flags out an error stating:
no route found to match “/company-profile/amazon.com” with
{:method=>:get})

How can i avoid this?

Just specify a catchall condition on the parameter :

map.connect ‘company/:company’, :controller => ‘community’, :action =>
‘search’, :company => /.*/

PS: this mailing list is almost french oriented :wink:


http://fabien.jakimowicz.com