Module: AppFrame::ControllerMethods::PaginationSupport
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/app_frame/controller_methods.rb
Instance Method Summary collapse
-
#collection ⇒ Object
paginate collection.
- #count ⇒ Object
- #page ⇒ Object
- #per_page ⇒ Object
Instance Method Details
#collection ⇒ Object
paginate collection
104 105 106 |
# File 'lib/app_frame/controller_methods.rb', line 104 def collection get_collection_ivar || set_collection_ivar(end_of_association_chain ? end_of_association_chain.page(page).per(per_page) : nil) end |
#count ⇒ Object
116 117 118 119 120 121 122 |
# File 'lib/app_frame/controller_methods.rb', line 116 def count @count ||= if end_of_association_chain end_of_association_chain.count else 0 end end |
#page ⇒ Object
108 109 110 |
# File 'lib/app_frame/controller_methods.rb', line 108 def page (params[:page] || 1).to_i end |
#per_page ⇒ Object
112 113 114 |
# File 'lib/app_frame/controller_methods.rb', line 112 def per_page 20 end |