json - Rails: to_json method not working as expected -


i'm bit stumped on this. have user model. trying convert instances json format. however, it's not returning expect:

> u = user.first > u.to_json => "\"#<user:0x104ac7718>\""  

instead of returning hash of object's attributes, to_json returning string name of model. ideas?


Comments