aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/compatibility.rb
blob: a9e46f93438c7b596e2edbb9a6ef9c6eea3127f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
module ActionController
  module Compatibility
    extend ActiveSupport::Concern

    # Temporary hax
    included do
      class << self
        delegate :default_charset=, :to => "ActionDispatch::Response"
      end

      self.protected_instance_variables = [
        :@_status, :@_headers, :@_params, :@_env, :@_response, :@_request,
        :@_view_runtime, :@_stream, :@_url_options, :@_action_has_layout
      ]
    end

    def _normalize_options(options)
      options[:text] = nil if options.delete(:nothing) == true
      options[:text] = " " if options.key?(:text) && options[:text].nil?
      super
    end

    def render_to_body(options)
      super || " "
    end

    def _handle_method_missing
      method_missing(@_action_name.to_sym)
    end

    def method_for_action(action_name)
      super || (respond_to?(:method_missing) && "_handle_method_missing")
    end

    def performed?
      response_body
    end
  end
end