How do I create a route in Rails that accepts a dotted (.) url? type "[email protected]"

0

Good morning,

I have an application where users register their information and each user's primary key is their email. So in the show method the parameter I get is email.

However, the default routes do not accept what comes after the point and when I try to access the information of some user, I get the error:

  

Could not find User with 'email' = user @ gmail

and below, this:

  

Request

     

Parameters:

     

{"id" = > "user @ gmail", "format" = > "com"}

I've tried creating custom routes but nothing works:

  match "usuarios/:email" => "usuarios#show", :via => [:get], :constraints => { :email => /.+@.+\..*/ }

I would appreciate it if someone had a suggestion of what I should do

    
asked by anonymous 06.08.2017 / 14:52

0 answers