From c3d1fda555c4bd5f8821d830c685ae5d0e7e52d0 Mon Sep 17 00:00:00 2001 From: Tom Ward Date: Fri, 18 Jul 2008 20:14:12 -0500 Subject: Set the response content type to that of found template if not explicitly set elsewhere [#444 state:resolved] Signed-off-by: Joshua Peek --- actionpack/lib/action_view/template.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'actionpack/lib/action_view/template.rb') 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 -- cgit v1.2.3