module BulkRouting::Resources

patch to ActionDispatch::Routing::Mapper

Constants

BULK_ACTIONS

Public Instance Methods

resources(*resources) { || ... } click to toggle source
Calls superclass method
# File lib/bulk_routing.rb, line 29
def resources(*resources, &block)
  super do
    yield if block_given?

    actions = parent_resource.actions
    collection do
      post   :bulk_create if actions.include?(:bulk_create)
      put    :bulk_update if actions.include?(:bulk_update)
      delete :bulk_destroy if actions.include?(:bulk_destroy)
    end
  end
end

Private Instance Methods

bulk_action?(action) click to toggle source
# File lib/bulk_routing.rb, line 44
def bulk_action?(action)
  resource_method_scope? && BULK_ACTIONS.include?(action.to_s)
end
path_for_action(action, path) click to toggle source
Calls superclass method
# File lib/bulk_routing.rb, line 48
def path_for_action(action, path)
  if bulk_action?(action)
    "#{@scope[:path]}/bulk"
  else
    super
  end
end