How do you merge models so that I can have the last 10 Posts, Feed Entries and Private Messages displayed in order?
Posts are stored in the “Post” model and ordered on “created_at”
Feed Entries are stored in “Planet” and ordered on “published_at”
Private Messages are stored in “Message” and need to be filtered with:
:conditions => "receiver_id = #{current_user.id}"
and ordered on “created_at”
You have to:
Here is some code:
Of course, depending on your models, you will have to change which method is used as “title” or “text”.
But if you happen to need many of such idioms, you should use Single Table Inheritance as we do in zena (a rails CMS).