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 L. wrote:

=> ‘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 N. 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.

On Apr 1, 12:32 pm, Mark B. [email protected]
wrote:

‘bar’

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


Posted viahttp://www.ruby-forum.com/.

Thanks! Works perfectly