Rails: identifying type of model in joined collection
If I make an array of records like so:
@records = Tapes.all + Discs.all
How can I identify which is which in the view and write code accordingly?
Something like this is what I'm after:
<% @records.each do |record| %>
<%= record.side if record.type => :tape %>
<% end %>
No comments:
Post a Comment