I want to retrieve an entire user object via a get request. Currently, on of my methods looks like this:
def user
@user = User.find(current_user.id)
render :json => @user
end
This returns the following json:
"{\"annonymous_token\":null,\"email\":\"john1@doe.com\",\"name\":\"john1@doe.com\"}"
My user object / schema has a many-to-many relationship with another model called pictures.
has_many :picturization
has_many :pictures, :through => :picturization
How can I modify my code such that returning the user also returns the pictures the user has. If helpful, I am using devise for user authentication.
Thanks!