So I have a basic controller where I want to find a user and return json.
This works fine
User.find_by(email: "foo@bar.com") => #<User>
This does NOT work
User.find_by(email: params[:email]) => nil
Route is setup as such
get 'foo/:email' => 'foo#bar'
When I log the value of params I can clearly see email is assigned and has a value.
I also have devise installed for my user auth so I'm not sure if that has something to do with it.
And help is much appreciated, I can not figure this one out.
Edit 1
Just figured it out. my route params /:email when just passing it is at route/foo@bar.com the param was only picking up "foo@bar" and not the .com
Fixed this by using ?email= instead.