Email address in url generates "no route" error

Hi,

I'm trying to make unsubscribe link and currently got a route like
this:

map.unsubscribe '/unsubscribe/:email', :controller => 'foo', :action
=> 'bar'

However when I put an email address in the url, it generates "no
route" error. It's probably caused by the dot in email addresses.

I'm using Rails 1.2.6. Any ideas how to fix it?

Thanks in advance

Hi,

Use a different char for the dot in the request. I'm assuming you're
generating the unsubscribe link.

Julian.

Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO
OUT 3rd APRIL
http://sensei.zenunit.com/

Julian Leviston wrote:

Hi,

Use a different char for the dot in the request. I'm assuming you're
generating the unsubscribe link.

Julian.

Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO
OUT 3rd APRIL
http://sensei.zenunit.com/

>
> Hi,
>
> I'm trying to make unsubscribe link and currently got a route like
> this:
>
> map.unsubscribe '/unsubscribe/:email', :controller => 'foo', :action
> => 'bar'
>
> However when I put an email address in the url, it generates "no
> route" error. It's probably caused by the dot in email addresses.
>
> I'm using Rails 1.2.6. Any ideas how to fix it?
>
> Thanks in advance
> >

Thanks.
Unfortunately I can't modify the url, at least not the email part -
users are redirected to this unsubscribe url from another app that
simply adds user's email at the end of the url.

Szymon Nowak wrote:

map.unsubscribe '/unsubscribe/:email', :controller => 'foo', :action
=> 'bar'

However when I put an email address in the url, it generates "no
route" error. It's probably caused by the dot in email addresses.

Try:

map.unsubscribe 'unsubscribe/*email', :controller => 'foo', :action =>
'bar'

instead. You'll have the email address in params[:email][0] as the
email part will create an array.

Thanks! Works perfectly