Module: RoutingFilter
- Defined in:
- lib/routing_filter/filters/uuid.rb,
lib/routing_filter.rb,
lib/routing_filter/chain.rb,
lib/routing_filter/filter.rb,
lib/routing_filter/version.rb,
lib/routing_filter/filters/locale.rb,
lib/routing_filter/filters/extension.rb,
lib/routing_filter/filters/pagination.rb
Overview
The Pagination filter extracts segments matching /page/:page from the end of the recognized url and exposes the page parameter as params. When a url is generated the filter adds the segments to the url accordingly if the page parameter is passed to the url helper.
incoming url: /products/page/1
filtered url: /products
params: params[:page] = 1
You can install the filter like this:
# in config/routes.rb
Rails.application.routes.draw do
filter :pagination
end
To make your named_route helpers or url_for add the pagination segments you can use:
products_path(:page => 1)
url_for(:products, :page => 1)
Defined Under Namespace
Classes: Chain, Extension, Filter, Locale, Pagination, Uuid
Constant Summary collapse
- VERSION =
'0.2.4'
Class Method Summary collapse
Class Method Details
.active=(active) ⇒ Object
17 18 19 |
# File 'lib/routing_filter.rb', line 17 def active=(active) @@active = active end |
.active? ⇒ Boolean
21 22 23 |
# File 'lib/routing_filter.rb', line 21 def active? defined?(@@active) ? @@active : @@active = true end |
.build(name, options) ⇒ Object
13 14 15 |
# File 'lib/routing_filter.rb', line 13 def build(name, ) const_get(name.to_s.camelize).new() end |