aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/new_base/compatibility.rb
blob: db471f7658a7e726dc2d6ad8888feb13e73ad533 (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
module ActionController
  module Rails2Compatibility
  
    # Temporary hax
    setup do
      cattr_accessor :session_options
      self.send(:class_variable_set, "@@session_options", {})
      
      cattr_accessor :allow_concurrency
      self.send(:class_variable_set, "@@allow_concurrency", false)
      
      cattr_accessor :param_parsers
      self.send(:class_variable_set, "@@param_parsers", { Mime::MULTIPART_FORM   => :multipart_form,
                          Mime::URL_ENCODED_FORM => :url_encoded_form,
                          Mime::XML              => :xml_simple,
                          Mime::JSON             => :json })
                          
      cattr_accessor :relative_url_root
      self.send(:class_variable_set, "@@relative_url_root", ENV['RAILS_RELATIVE_URL_ROOT'])
      
      cattr_accessor :default_charset
      self.send(:class_variable_set, "@@default_charset", "utf-8")
    end
  
    def render_to_body(options)
      if options.is_a?(Hash) && options.key?(:template)
        options[:template].sub!(/^\//, '')
      end
      super
    end
   
   def _layout_for_name(name)
     name &&= name.sub(%r{^/?layouts/}, '')
     super
   end
   
  end
end