diff options
author | José Valim <jose.valim@gmail.com> | 2010-03-12 20:39:53 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-03-12 20:39:53 +0100 |
commit | f2c0a353aef41a6df2de8e1fe3eaa3d8bbd8a6dd (patch) | |
tree | a854e0b7b79968f7f7cdfb57d29fd6644805c5ae /actionpack/lib/action_view/template | |
parent | 2a12686832fbcf0566454904a5d733998506bf56 (diff) | |
download | rails-f2c0a353aef41a6df2de8e1fe3eaa3d8bbd8a6dd.tar.gz rails-f2c0a353aef41a6df2de8e1fe3eaa3d8bbd8a6dd.tar.bz2 rails-f2c0a353aef41a6df2de8e1fe3eaa3d8bbd8a6dd.zip |
Finish cleaning up rendering stack from views and move assigns evaluation to controller (so plugins and/or controllers can overwrite just one method).
Diffstat (limited to 'actionpack/lib/action_view/template')
-rw-r--r-- | actionpack/lib/action_view/template/handlers/rjs.rb | 3 | ||||
-rw-r--r-- | actionpack/lib/action_view/template/text.rb | 14 |
2 files changed, 7 insertions, 10 deletions
diff --git a/actionpack/lib/action_view/template/handlers/rjs.rb b/actionpack/lib/action_view/template/handlers/rjs.rb index 63e7dc0902..128be5077c 100644 --- a/actionpack/lib/action_view/template/handlers/rjs.rb +++ b/actionpack/lib/action_view/template/handlers/rjs.rb @@ -6,8 +6,7 @@ module ActionView self.default_format = Mime::JS def compile(template) - "controller.response.content_type ||= Mime::JS;" + - "update_page do |page|;#{template.source}\nend" + "update_page do |page|;#{template.source}\nend" end def default_format diff --git a/actionpack/lib/action_view/template/text.rb b/actionpack/lib/action_view/template/text.rb index df394b0fb0..269340514c 100644 --- a/actionpack/lib/action_view/template/text.rb +++ b/actionpack/lib/action_view/template/text.rb @@ -1,10 +1,12 @@ module ActionView #:nodoc: class Template class Text < String #:nodoc: - def initialize(string, content_type = nil) + attr_accessor :mime_type + + def initialize(string, mime_type = nil) super(string.to_s) - @content_type = Mime[content_type] || content_type if content_type - @content_type ||= Mime::TEXT + @mime_type = Mime[mime_type] || mime_type if mime_type + @mime_type ||= Mime::TEXT end def identifier @@ -19,12 +21,8 @@ module ActionView #:nodoc: to_s end - def mime_type - @content_type - end - def formats - [@content_type.to_sym] + [@mime_type.to_sym] end def partial? |