The following shows an easy to turn a `liked_by` text column into an array for storage.

class Posts < ActiveRecord::Base
  serialize :liked_by, Array
end

Now I can have a cached column on the post model of user ids who liked the row without a join.

>> post = Post.first
>> post.liked_by
#=> [12, 34, 45, 21, 12]

:)

Leave a Reply

Your email address will not be published. Required fields are marked *