Assuming following model:
class Account < ActiveRecord::Base
has_many :orders
end
class Order < ActiveRecord::Base
belongs_to :account
scope :active, -> { where('orders.state = ?', 'ACTIVE') }
scope :closed, -> { where('orders.state <> ?', 'ACTIVE') }
end
In account/show
view I have two lists: one for active orders and other with closed ones.
Now I need to add a paging for each of the lists (using will_paginate
gem) but I don't know what is the best way to route the requests for that and how to handle two collections in the controller action.