I want to invite people who passes their email inside an url like this:
localhost:3000/invite_me/[email protected]
I tried this match
but it isn't working.
match "/invite_me/:email" => "application#invite_me",
:constraints => { :email => '/.+@.+\..*/' }
I'm getting the following error:
No route matches [GET] "/invite_me/[email protected]"
rake routes output:
root / application#index
/invite_me/:email(.:format) application#invite_me {:email=>"/.+@.+\\..*/"}
Your constraint needs to be an actual regular expression and not a string
match "/invite_me/:email" => "application#invite_me",
:constraints => { :email => '/.+@.+\..*/' }
Should be
match "/invite_me/:email" => "application#invite_me",
:constraints => { :email => /.+@.+\..*/ }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With