Module: CloudSearchRails::Search::WillPaginateMethods
- Defined in:
- lib/cloud_search_rails/search.rb
Overview
methods of WillPaginate compatibility
Instance Attribute Summary collapse
-
#current_page ⇒ Object
Returns the value of attribute current_page.
-
#per_page ⇒ Object
Returns the value of attribute per_page.
-
#total_entries ⇒ Object
Returns the value of attribute total_entries.
Instance Method Summary collapse
-
#offset ⇒ Object
calculated offset given the current page and the number of entries per page.
-
#total_pages ⇒ Object
total number of pages.
Instance Attribute Details
#current_page ⇒ Object
Returns the value of attribute current_page.
25 26 27 |
# File 'lib/cloud_search_rails/search.rb', line 25 def current_page @current_page end |
#per_page ⇒ Object
Returns the value of attribute per_page.
25 26 27 |
# File 'lib/cloud_search_rails/search.rb', line 25 def per_page @per_page end |
#total_entries ⇒ Object
Returns the value of attribute total_entries.
25 26 27 |
# File 'lib/cloud_search_rails/search.rb', line 25 def total_entries @total_entries end |
Instance Method Details
#offset ⇒ Object
calculated offset given the current page and the number of entries per page
29 30 31 |
# File 'lib/cloud_search_rails/search.rb', line 29 def offset (self.current_page - 1) * self.per_page end |
#total_pages ⇒ Object
total number of pages
34 35 36 |
# File 'lib/cloud_search_rails/search.rb', line 34 def total_pages (self.total_entries.to_f / self.per_page.to_f).ceil end |