class Comment < ActiveRecord::Base
# updated_at :datetime
belongs_to :user
end
class Post < ActiveRecord::Base
# last_edit_at :datetime
belongs_to :user
end
I want to query a certain user and display her comments and posts chronologically, based on her comments updated_at attribute and posts last_edit_at attribute respectively.
I've tried with an answer from a similar question, but there the attributes are the same:
combined_sorted = (User.comments + User.likes).sort{|a,b| a.created_at <=> b.created_at }
How could I accomplish the above but with unique attributes?