I am trying to fuse to objects into a single stream.
I created a new model and controller called Newsfeed. I have it so that newsfeed has_many :messages and has_many
You could do something as :
controller:
def index
messages = Messages.all
images = Images.all
@feed = (messages + images).order_by(&:created_at)
end
view index.html.erb :
<%= render @feed %>
view _feed.html.erb :
<% if feed.is_a? Message %>
<%= render "message", :locals => {:message => feed}%>
<% else %>
<%= render "image", :locals => {:image => feed}%>
<% end %>
And add 2 partials _message.html.erb and _image.html.erb