module SimpleDrilldown::Routing

Routing helper methods

Public Instance Methods

draw_drilldown(path, controller = nil) { || ... } click to toggle source
# File lib/simple_drilldown/routing.rb, line 6
def draw_drilldown(path, controller = nil)
  path = "#{path}_drilldown" unless /_drilldown$/.match?(path)
  controller ||= path
  get "#{path}(.:format)" => "#{controller}#index", as: path
  scope path, controller:, as: path do
    { excel_export: :xlsx, excel_export_records: :xlsx, html_export: :html }.each do |action, format|
      get action, defaults: { format: }
    end
    get 'choices/:dimension_name', action: :choices, as: :choices
    yield if block_given?
  end
end