@entries = (@customer.payments + @customer.invoices).sort{|a,b| a.date <=> b.date} When iterating through @entries in the view, you''ll can just use ''entry.type'' for the second column, if that''s literally all you need. It might be nicer, though, to have a different partial for each type, and render each accordingly: <% @entries.each do |entry| %> <%= render :partial => (@result.type == Payment ? "payment" : "invoice"), :locals => {:entry => entry} %> <% end %> Alternatively, it might be sufficient to simply change the style for each line depending on type. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Max Williams wrote:> @entries = (@customer.payments + @customer.invoices).sort{|a,b| a.date > <=> b.date} >Oh and by the way, if you need to split this across several pages, you can just call .paginate on the results with a page number, ie @entries = (@customer.payments + @customer.invoices).sort{|a,b| a.date <=> b.date}.paginate(:page => params[:page], :per_page => 20) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Wow, that''s easy... Kinda figured that rails would make this simple... Thanks very much! On Jul 30, 9:58 am, Max Williams <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Max Williams wrote: > > @entries = (@customer.payments + @customer.invoices).sort{|a,b| a.date > > <=> b.date} > > Oh and by the way, if you need to split this across several pages, you > can just call .paginate on the results with a page number, ie > > @entries = (@customer.payments + @customer.invoices).sort{|a,b| a.date > <=> b.date}.paginate(:page => params[:page], :per_page => 20) > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---