diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-05-26 11:34:02 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-05-26 11:34:02 -0300 |
commit | b3d40546923b194a89be0d9e00758864fa60b9e8 (patch) | |
tree | 8acac475b371d61924c67a439704c82c61968fff /actionpack/lib/action_view/template/template.rb | |
parent | aa5512299041efb923cd582fd26009a72b9ec670 (diff) | |
parent | 2f59066470193c6219dfd958fc5d8096a2ddee68 (diff) | |
download | rails-b3d40546923b194a89be0d9e00758864fa60b9e8.tar.gz rails-b3d40546923b194a89be0d9e00758864fa60b9e8.tar.bz2 rails-b3d40546923b194a89be0d9e00758864fa60b9e8.zip |
Merge commit 'rails/master'
Diffstat (limited to 'actionpack/lib/action_view/template/template.rb')
-rw-r--r-- | actionpack/lib/action_view/template/template.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/actionpack/lib/action_view/template/template.rb b/actionpack/lib/action_view/template/template.rb index dcc5006103..f61dd591a5 100644 --- a/actionpack/lib/action_view/template/template.rb +++ b/actionpack/lib/action_view/template/template.rb @@ -7,13 +7,20 @@ require "action_view/template/path" module ActionView class Template extend TemplateHandlers - attr_reader :source, :identifier, :handler + attr_reader :source, :identifier, :handler, :mime_type, :details def initialize(source, identifier, handler, details) @source = source @identifier = identifier @handler = handler @details = details + + format = details.delete(:format) || begin + # TODO: Clean this up + handler.respond_to?(:default_format) ? handler.default_format.to_sym.to_s : "html" + end + @mime_type = Mime::Type.lookup_by_extension(format.to_s) + @details[:formats] = Array.wrap(format && format.to_sym) end def render(view, locals, &blk) @@ -35,12 +42,7 @@ module ActionView def partial? @details[:partial] end - - # TODO: Move out of Template - def mime_type - Mime::Type.lookup_by_extension(@details[:format].to_s) if @details[:format] - end - + private def compile(locals, view) |