0
Good morning,
I have an application where users register their information and the primary key of each user is their email. So in the method show the parameter I receive is the email.
However, default routes do not accept what comes after the point and when I try to access some user’s information, I get the error:
Couldn’t find Usuario with 'email'=usuario@gmail
and underneath, that:
Request
Parameters:
{"id"=>"user@gmail", "format"=>"com"}
I’ve tried to create custom routes but nothing works:
match "usuarios/:email" => "usuarios#show", :via => [:get], :constraints => { :email => /.+@.+\..*/ }
I would really appreciate it if someone had a suggestion of what I should do
tries to change the regular expression to
/\A[\w+\-.]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i
– 13dev
Gave another error: Regexp Anchor characters are not allowed in routing Requirements: / A[ w+-. ]+@[a-z d-]+(.[a-z]+)*. [a-z]+ z/i
– Marcio