module Granite::Routing::Mapping

Public Instance Methods

app(*) click to toggle source

Override the `ActionDispatch::Routing::Mapper::Mapping#app` method to be able to mount custom Dispatcher objects. Otherwise, the only way to point a dispatcher to business actions is to mount it as a Rack app but we want to use regular Rails flow.

Calls superclass method
# File lib/granite/routing/mapping.rb, line 8
def app(*)
  if to.is_a?(Granite::Dispatcher)
    ActionDispatch::Routing::Mapper::Constraints.new(
      to,
      to.constraints,
      ActionDispatch::Routing::Mapper::Constraints::SERVE
    )
  else
    super
  end
end