diff options
author | Tom Ward <tom@popdog.net> | 2008-07-18 20:14:12 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-07-18 20:14:12 -0500 |
commit | c3d1fda555c4bd5f8821d830c685ae5d0e7e52d0 (patch) | |
tree | 41a5e9b018d724a82c33ab117bc1e6403e6cbbc5 /actionpack/lib/action_view/template.rb | |
parent | d2ccb852d4e1f6f1b01e43f32213053ae3bef408 (diff) | |
download | rails-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/template.rb')
-rw-r--r-- | actionpack/lib/action_view/template.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb index eba42518d7..1f528dd900 100644 --- a/actionpack/lib/action_view/template.rb +++ b/actionpack/lib/action_view/template.rb @@ -22,6 +22,11 @@ module ActionView #:nodoc: end memoize :format_and_extension + def mime_type + Mime::Type.lookup_by_extension(format) if format + end + memoize :mime_type + def path [base_path, [name, format, extension].compact.join('.')].compact.join('/') end |