I’m using rabl gem
show.rabl
object @user
attributes :id, :name, :realname, :email
And i get
{"user":{"id":1,"name":"username","email":"mail@mail.com"}}
The problem is that anyone can see this info if they open http://website.com/users/user.json link
In my db each user after logging have unique auth_token field.
Question is – I want to see this info only with this link – http://website.com/users/user.json?auth_token=yLrUAxWB2szkvx9jBEGv
Create a check or work with some authorization gem like
cancan.Raw example so you can get a grasp (untested, wrote it on the phone…):