Module: Repertoire::Faceting::Routing

Included in:
ActionDispatch::Routing::Mapper
Defined in:
lib/repertoire-faceting/routing.rb

Overview

Standard routing extensions for Repertoire Faceting webservices.

Example::Application.routes.draw do
  faceting_for :paintings
end

N.B. Include faceting routes before any resources!

Instance Method Summary collapse

Instance Method Details

#faceting_for(*controllers) ⇒ Object

Add routes for the faceting webservices provided by the Controller mixin.



17
18
19
20
21
22
23
# File 'lib/repertoire-faceting/routing.rb', line 17

def faceting_for(*controllers)
  controllers.map!(&:to_sym)
  controllers.each do |ctlr|
      get "/#{ctlr}/counts/:facet", :controller => ctlr, :action => 'counts'
      get "/#{ctlr}/results",       :controller => ctlr, :action => 'results'
  end
end