Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/compendium/engine/mount.rb

Defined Under Namespace

Classes: ExportRouter

Instance Method Summary collapse

Instance Method Details

#mount_compendium(options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/compendium/engine/mount.rb', line 10

def mount_compendium(options = {})
  scope options[:at], controller: options.fetch(:controller, 'compendium/reports'), as: 'compendium_reports' do
    get ':report_name', action: :setup, constraints: { format: :html }, as: 'setup'
    match ':report_name/export', action: :export, as: 'export', via: [:get, :post]
    post ':report_name(/:query)', constraints: ExportRouter.new, action: :export, as: 'export_post'
    match ':report_name(/:query)', action: :run, as: 'run', via: [:get, :post]
    root action: :index, as: 'root'
  end
end