diff options
author | José Valim <jose.valim@gmail.com> | 2010-02-01 11:41:16 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-02-01 11:41:16 +0100 |
commit | 66615f25cf30835968f5c4798c5befea0d357e89 (patch) | |
tree | e364f1340b605b861c688384914518e4964f8d17 /actionpack/lib/abstract_controller/rendering.rb | |
parent | 0dece7929cf5b04f008640936fb3ece24ce80daa (diff) | |
parent | e5ab4b0d07ade8d89d633ca744c0eafbc53ee921 (diff) | |
download | rails-66615f25cf30835968f5c4798c5befea0d357e89.tar.gz rails-66615f25cf30835968f5c4798c5befea0d357e89.tar.bz2 rails-66615f25cf30835968f5c4798c5befea0d357e89.zip |
Merge branch 'master' of gitproxy:rails/rails
Diffstat (limited to 'actionpack/lib/abstract_controller/rendering.rb')
-rw-r--r-- | actionpack/lib/abstract_controller/rendering.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb index ac407bda5e..619a49571b 100644 --- a/actionpack/lib/abstract_controller/rendering.rb +++ b/actionpack/lib/abstract_controller/rendering.rb @@ -1,4 +1,7 @@ require "abstract_controller/base" +require 'active_support/core_ext/class/attribute' +require 'active_support/core_ext/module/delegation' +require 'active_support/core_ext/array/wrap' module AbstractController class DoubleRenderError < Error @@ -13,8 +16,9 @@ module AbstractController extend ActiveSupport::Concern included do - extlib_inheritable_accessor :_view_paths - self._view_paths ||= ActionView::PathSet.new + class_attribute :_view_paths + delegate :_view_paths, :to => :'self.class' + self._view_paths = ActionView::PathSet.new end # An instance of a view class. The default view class is ActionView::Base @@ -156,7 +160,6 @@ module AbstractController elsif options.key?(:file) options[:_template_name] = options[:file] end - name = (options[:_template_name] || options[:action] || action_name).to_s options[:_prefix] ||= _prefix if (options.keys & [:partial, :file, :template]).empty? @@ -201,7 +204,7 @@ module AbstractController # the default view path. You may also provide a custom view path # (see ActionView::ViewPathSet for more information) def append_view_path(path) - self.view_paths << path + self.view_paths = view_paths.dup + Array.wrap(path) end # Prepend a path to the list of view paths for this controller. @@ -212,12 +215,12 @@ module AbstractController # (see ActionView::ViewPathSet for more information) def prepend_view_path(path) clear_template_caches! - self.view_paths.unshift(path) + self.view_paths = Array.wrap(path) + view_paths.dup end # A list of all of the default view paths for this controller. def view_paths - self._view_paths + _view_paths end # Set the view paths. @@ -228,7 +231,8 @@ module AbstractController def view_paths=(paths) clear_template_caches! self._view_paths = paths.is_a?(ActionView::PathSet) ? paths : ActionView::Base.process_view_paths(paths) + _view_paths.freeze end end end -end
\ No newline at end of file +end |