I have an Activity menu, that should display items from two different models sorted by created_at.
I know how to iterate and sort items from individual models, however when I try to combine the results. I'm then unable to iterate through as the attributes would be different. So below doesn't make sense.
<% @post_and_events = @posts + current_user.events %>
<% for both in @post_and_events %>
<%= both.? %>
<% end %>
<% end %>
As posts have different attributes from events.
In my head I'm thinking to sort them separately, however I'm unsure how to display @post
and @events
sorted as a group, instead of show results of one then the other.
Follow up to: this