I have a table/class :
class User < ActiveRecord::Base
serialize :photos
end
When I query, via something like this:
Post.joins(:user).select('users.username, users.photo AS user_photo')
This returns the photo, but not as a 'hash' but rather as the raw string stored in the database:
{
"post_type" = 0;
"user_id" = 1;
"user_photo" = "---\n:photo: http://res.cloudinary.com/jhess2991/image/upload/eb29c343249624.png\n:thumb: http://res.cloudinary.com/jhess2991/image/upload/c_scale,h_180,w_180/eb29c3423429624.png\n";
username = HDILOfficial;
}
Of course, this only happens when I query from a ActiveRecord class other than User. If I query from User (User.select(blah blah blah)) then it returns as a normal hash.
So my question is, how can I make it treat 'photo' as a hash when querying from another class?