Module: RailsPaginate::Helpers::ActionView
- Defined in:
- lib/rails_paginate/helpers/action_view.rb
Overview
ActionView extension for create paginate view helper
Instance Method Summary collapse
-
#paginate(*args) ⇒ Object
view_helper for paginate.
Instance Method Details
#paginate(*args) ⇒ Object
view_helper for paginate
Options
:id :class
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rails_paginate/helpers/action_view.rb', line 9 def paginate(*args) = args. raise ArgumentError, "first argument must be a RailsPaginate::Collection" unless args.first.is_a? RailsPaginate::Collection collection = args.first # p @controller # p url_for(:action => :index, :controller => :dummy) # renderer renderer = [:renderer] || RailsPaginate.default_renderer pager = [:pager] || RailsPaginate.default_pager attributes = {} attributes[:class] = "pagination #{[:class]}".strip attributes[:id] = [:id] unless [:id].blank? # load classes renderer = RailsPaginate.renderer(renderer) pager = RailsPaginate.pager(pager) content_tag :div, attributes do renderer.new(self, collection, pager.new(collection), ).render end end |