Another simple question: per_page in pagination


#1

Hi,

Why can’t I use a variable to specify the :per_page attribute when using
the most basic form of pagination? (if I use a hardcode number, it
runs) What did I do? Thx.

My code:

def list_orders
page_size = 20

order_pages, @orders = paginate(:orders, :per_page => page_size)
end

My Errors:

undefined method `>’ for false:FalseClass

RAILS_ROOT: ./script/…/config/…
Application Trace | Framework Trace | Full Trace

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/
pagination.rb:210:in <=' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/ pagination.rb:210:ininitialize’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/
pagination.rb:191:in new' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/ pagination.rb:191:inpaginator_and_collection_for’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/
pagination.rb:124:in paginate' #{RAILS_ROOT}/app/controllers/book_viewer_controller.rb:77:inlist_orders’

  • RoR newbie -

#2

Could anyone help me clarify this? I finally had some code working such
that I can sort by column headings on paginated pages… But being
unable to specify :per_page in the search box is a bit annoying.

Thanks…
On Monday, February 13, 2006, at 5:33 PM, xiheng xu wrote:


c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/

http://lists.rubyonrails.org/mailman/listinfo/rails

  • RoR newbie -