Skip to content
This repository
Browse code

Move ContentType inline for now.

Trying to avoid premature proliferation of modules.
  • Loading branch information...
commit d58b57a3caf4ad434c2be4f63eecd9a1921c7c4a 1 parent b98e496
authored April 29, 2009
1  actionpack/lib/action_controller/new_base.rb
... ...
@@ -1,5 +1,4 @@
1 1
 module ActionController
2  
-  autoload :ContentType,          "action_controller/new_base/content_type"
3 2
   autoload :HideActions,          "action_controller/new_base/hide_actions"
4 3
   autoload :Http,                 "action_controller/new_base/base"
5 4
   autoload :Layouts,              "action_controller/new_base/layouts"
15  actionpack/lib/action_controller/new_base/content_type.rb
... ...
@@ -1,15 +0,0 @@
1  
-module ActionController
2  
-  module ContentType
3  
-    
4  
-    def render_to_body(options = {})
5  
-      if content_type = options[:content_type]
6  
-        response.content_type = content_type
7  
-      end
8  
-      
9  
-      ret = super
10  
-      response.content_type ||= options[:_template].mime_type
11  
-      ret
12  
-    end
13  
-
14  
-  end
15  
-end
10  actionpack/lib/action_controller/new_base/renderer.rb
@@ -24,7 +24,9 @@ def render_to_body(options)
24 24
         options[:_prefix] = _prefix 
25 25
       end
26 26
       
27  
-      super(options)
  27
+      ret = super(options)
  28
+      response.content_type ||= options[:_template].mime_type
  29
+      ret
28 30
     end
29 31
     
30 32
   private
@@ -43,9 +45,9 @@ def _text(options)
43 45
     end
44 46
   
45 47
     def _process_options(options)
46  
-      if status = options[:status]
47  
-        response.status = status.to_i
48  
-      end
  48
+      status, content_type = options.values_at(:status, :content_type)
  49
+      response.status = status.to_i if status
  50
+      response.content_type = content_type if content_type
49 51
     end
50 52
   end
51 53
 end
1  actionpack/test/new_base/test_helper.rb
@@ -42,7 +42,6 @@ class Base2 < Http
42 42
     use ActionController::UrlFor
43 43
     use ActionController::Renderer
44 44
     use ActionController::Layouts
45  
-    use ActionController::ContentType
46 45
     
47 46
     def self.inherited(klass)
48 47
       ::ActionController::Base2.subclasses << klass.to_s

0 notes on commit d58b57a

Please sign in to comment.
Something went wrong with that request. Please try again.