Module: Jets::Controller::Compat::ActionController::Metal
- Extended by:
- ActiveSupport::Concern
- Included in:
- Base
- Defined in:
- lib/jets/controller/compat/action_controller/metal.rb
Instance Method Summary collapse
-
#dispatch! ⇒ Object
One key difference between process! vs dispatch!.
-
#initialize ⇒ Object
End of the module include chain.
- #method_override! ⇒ Object
-
#performed? ⇒ Boolean
Tests if render or redirect has already happened.
-
#response=(triplet) ⇒ Object
Unsure how Rails defines this but this is the Rails behavior according to the Kingsman/Devise port.
-
#response_body=(body) ⇒ Object
Not using rack.response.body directly because its value is wrapped in an Array, IE: [body] and ActionController components check response_body assuming it can be nil or a String.
Instance Method Details
#dispatch! ⇒ Object
One key difference between process! vs dispatch!
process! - takes the request through the middleware stack
dispatch! - does not
dispatch! is useful for megamode or mounted applications
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/jets/controller/compat/action_controller/metal.rb', line 45 def dispatch! # extend Jets.application.routes.url_helpers # extend Blorgh::Engine.routes.url_helpers # ActionView::Base.send :include, Jets.application.routes.url_helpers # ActionView::Base.send :include, Blorgh::Engine.routes.url_helpers # extend Jets.application.routes.mounted_helpers method_override! process_action commit_flash response.to_a end |
#initialize ⇒ Object
End of the module include chain. Go back from the ActionController::Base#initialize() interface to the original Jets::Lambda::Functions#initialize(event, context, meth) interface
34 35 36 |
# File 'lib/jets/controller/compat/action_controller/metal.rb', line 34 def initialize super(@event, @context, @meth) end |
#method_override! ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/jets/controller/compat/action_controller/metal.rb', line 63 def method_override! env = request.env if env['rack.methodoverride.original_method'] && env['REQUEST_METHOD'] == 'DELETE' @original_meth = @meth @meth = "destroy" end end |
#performed? ⇒ Boolean
Tests if render or redirect has already happened.
95 96 97 |
# File 'lib/jets/controller/compat/action_controller/metal.rb', line 95 def performed? response_body || response.committed? end |
#response=(triplet) ⇒ Object
Unsure how Rails defines this but this is the Rails behavior according to the Kingsman/Devise port
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/jets/controller/compat/action_controller/metal.rb', line 83 def response=(triplet) if triplet.is_a?(Array) status, headers, body = triplet self.status = status self.headers.merge!(headers) self.response_body = body else self.response_body = triplet # string end end |
#response_body=(body) ⇒ Object
Not using rack.response.body directly because its value is wrapped in an Array, IE: [body] and ActionController components check response_body assuming it can be nil or a String. So we assign the String at the controller.response_body level and [body] at the the Response#body= level.
75 76 77 78 79 80 |
# File 'lib/jets/controller/compat/action_controller/metal.rb', line 75 def response_body=(body) body = [body] unless body.nil? || body.respond_to?(:each) return unless body response.body = body super end |