Rails partial show latest 5 kases
- by Danny McClelland
Hi Everyone,
I have my application setup with a few different partials working well. I have asked here how to get a partial working to show the latest entry in the kase model, but now I need to show the latest 5 entries in the kase model in a partial.
I have duplicated the show most recent one partial and it's working where I need it to but only shows the last entry, what do I need to change to show the last 5?
_recent_kases.html.erb
<% if Kase.most_recentfive %>
<h4>The most recent case reference is <strong><%= Kase.most_recentfive.jobno %></strong></h4>
<% end %>
kase.rb
def self.most_recentfive
first(:order => 'id DESC')
end
Thanks,
Danny