I have a slight problem,
I have managed to iterate 2 objects in the same one, my problem is that it does not work with will_paginate
, and to be able to do that iteration I support the Ruby method: sort_by
but apparently this does not work with any gem of page, what suggestion do you give me, I hope you can give me a hand, here I share my code:
enterprises_controller.rb
def show
@items = @enterprise.jobs + @enterprise.products
@items = @items.sort_by do |item| item.created_at end
@items = @items.reverse
end
show.html.erb
<% @items = @items.each do |item| %>
<%= item.name %> <br>
<% end %>