Method: ActionController::Metal.action

Defined in:
actionpack/lib/action_controller/metal.rb

.action(name) ⇒ Object

Returns a Rack endpoint for the given action name.



315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'actionpack/lib/action_controller/metal.rb', line 315

def self.action(name)
  app = lambda { |env|
    req = ActionDispatch::Request.new(env)
    res = make_response! req
    new.dispatch(name, req, res)
  }

  if middleware_stack.any?
    middleware_stack.build(name, app)
  else
    app
  end
end