diff options
author | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-04-29 17:32:55 -0700 |
---|---|---|
committer | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-05-01 17:31:02 -0700 |
commit | b98e496c039b7bde4a2de9c02809e0b4ee0679ae (patch) | |
tree | 56298784a3f08d2476cc339b3465ebea707911de /actionpack/lib/action_controller | |
parent | 49834e088bf8d02a4f75793a42868f2aea8749a4 (diff) | |
download | rails-b98e496c039b7bde4a2de9c02809e0b4ee0679ae.tar.gz rails-b98e496c039b7bde4a2de9c02809e0b4ee0679ae.tar.bz2 rails-b98e496c039b7bde4a2de9c02809e0b4ee0679ae.zip |
Support implicit and explicit content types
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/new_base.rb | 1 | ||||
-rw-r--r-- | actionpack/lib/action_controller/new_base/content_type.rb | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/new_base.rb b/actionpack/lib/action_controller/new_base.rb index bfd8120e10..9c8a6d0216 100644 --- a/actionpack/lib/action_controller/new_base.rb +++ b/actionpack/lib/action_controller/new_base.rb @@ -1,4 +1,5 @@ module ActionController + autoload :ContentType, "action_controller/new_base/content_type" autoload :HideActions, "action_controller/new_base/hide_actions" autoload :Http, "action_controller/new_base/base" autoload :Layouts, "action_controller/new_base/layouts" diff --git a/actionpack/lib/action_controller/new_base/content_type.rb b/actionpack/lib/action_controller/new_base/content_type.rb new file mode 100644 index 0000000000..d2206a31af --- /dev/null +++ b/actionpack/lib/action_controller/new_base/content_type.rb @@ -0,0 +1,15 @@ +module ActionController + module ContentType + + def render_to_body(options = {}) + if content_type = options[:content_type] + response.content_type = content_type + end + + ret = super + response.content_type ||= options[:_template].mime_type + ret + end + + end +end
\ No newline at end of file |