aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/base.rb
diff options
context:
space:
mode:
authorTom Ward <tom@popdog.net>2008-07-18 20:14:12 -0500
committerJoshua Peek <josh@joshpeek.com>2008-07-18 20:14:12 -0500
commitc3d1fda555c4bd5f8821d830c685ae5d0e7e52d0 (patch)
tree41a5e9b018d724a82c33ab117bc1e6403e6cbbc5 /actionpack/lib/action_view/base.rb
parentd2ccb852d4e1f6f1b01e43f32213053ae3bef408 (diff)
downloadrails-c3d1fda555c4bd5f8821d830c685ae5d0e7e52d0.tar.gz
rails-c3d1fda555c4bd5f8821d830c685ae5d0e7e52d0.tar.bz2
rails-c3d1fda555c4bd5f8821d830c685ae5d0e7e52d0.zip
Set the response content type to that of found template if not explicitly set elsewhere [#444 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/lib/action_view/base.rb')
-rw-r--r--actionpack/lib/action_view/base.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index ae6b284854..fe51af62e6 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -379,6 +379,12 @@ module ActionView #:nodoc:
@assigns.each { |key, value| instance_variable_set("@#{key}", value) }
end
+ def set_controller_content_type(content_type)
+ if controller.respond_to?(:response)
+ controller.response.content_type ||= content_type
+ end
+ end
+
def execute(method, local_assigns = {})
send(method, local_assigns) do |*names|
instance_variable_get "@content_for_#{names.first || 'layout'}"