I’m interested in adding two objects to a serialized meta-data column in my activity feed model (Rails 3.1) to cut down on db calls.
Example: I have an Activity model with a data:text column which is serialized. I know I can add a Book object to this model and get it back as so:
test = Activity.create(:data => Book.find(1))
test.book.author # => James Joyce
Can I add two objects to this column (e.g. a Book and a User)? I tried using hashes/arrays but couldn’t get them to work properly. Thanks in advance.
Here’s how you might use a hash: