module Wice

Public Class Methods

define_routes(map, controller) click to toggle source

Used in routes.rb to define routes to the query processing controller. Parameters:

  • map - the context of the routes execution (instance of ActionDispatch::Routing::Mapper). Normally use self for the first argument: Wice::define_routes(self, 'queries')

  • controller - name of the query processing controller, i.e. 'queries' if the controller is QueriesController .

Read section “Saving Queries How-To” in README for more details.

# File lib/wice/wice_grid_serialized_queries_controller.rb, line 9
def define_routes(map, controller)
  controller = controller.to_s

  map.post '/wice_grid_serialized_queries/:grid_name',
           to: "#{controller}#create_saved_query",
           as: 'create_serialized_query'

  map.post '/wice_grid_serialized_queries/:grid_name/:id',
           to: "#{controller}#delete_saved_query",
           as: 'delete_serialized_query'
end