g0nzo
April 1, 2008, 10:17am
#1
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
g0nzo
April 1, 2008, 10:26am
#2
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/
g0nzo
April 1, 2008, 12:11pm
#3
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.
g0nzo
April 1, 2008, 12:32pm
#4
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.
g0nzo
April 1, 2008, 8:42pm
#5
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