aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller/rendering.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-03-08 15:19:03 +0100
committerJosé Valim <jose.valim@gmail.com>2010-03-08 15:19:03 +0100
commit44ebab96da0ab47cc45c64a6efdd2cbb80f9d042 (patch)
treeedb94d25dbc903c5148ef6bd1cf58df7149f0748 /actionpack/lib/abstract_controller/rendering.rb
parentea68fe59c670dd5580f3aa34fdfa0eb89eb717d3 (diff)
downloadrails-44ebab96da0ab47cc45c64a6efdd2cbb80f9d042.tar.gz
rails-44ebab96da0ab47cc45c64a6efdd2cbb80f9d042.tar.bz2
rails-44ebab96da0ab47cc45c64a6efdd2cbb80f9d042.zip
Rename Template::Lookup to LookupContext.
Diffstat (limited to 'actionpack/lib/abstract_controller/rendering.rb')
-rw-r--r--actionpack/lib/abstract_controller/rendering.rb35
1 files changed, 11 insertions, 24 deletions
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb
index d9087ce294..356f1ec7f6 100644
--- a/actionpack/lib/abstract_controller/rendering.rb
+++ b/actionpack/lib/abstract_controller/rendering.rb
@@ -18,39 +18,26 @@ module AbstractController
self._view_paths = ActionView::PathSet.new
end
- delegate :formats, :formats=, :to => :template_lookup
- delegate :_view_paths, :to => :'self.class'
+ delegate :find_template, :template_exists?,
+ :view_paths, :formats, :formats=, :to => :lookup_context
- def template_lookup
- @template_lookup ||= ActionView::Template::Lookup.new(_view_paths, details_for_lookup)
+ # LookupContext is the object responsible to hold all information required to lookup
+ # templates, i.e. view paths and details. Check ActionView::LookupContext for more
+ # information.
+ def lookup_context
+ @lookup_context ||= ActionView::LookupContext.new(self.class._view_paths, details_for_lookup)
end
def details_for_lookup
{ }
end
- # The list of view paths for this controller. See ActionView::ViewPathSet for
- # more details about writing custom view paths.
- def view_paths
- template_lookup.view_paths
- end
-
def append_view_path(path)
- template_lookup.view_paths.push(*path)
+ lookup_context.view_paths.push(*path)
end
def prepend_view_path(path)
- template_lookup.view_paths.unshift(*path)
- end
-
- protected
-
- def template_exists?(*args)
- template_lookup.exists?(*args)
- end
-
- def find_template(*args)
- template_lookup.find(*args)
+ lookup_context.view_paths.unshift(*path)
end
module ClassMethods
@@ -191,12 +178,12 @@ module AbstractController
options[:template] ||= (options[:action] || action_name).to_s
details = _normalize_details(options)
- template_lookup.details = details
+ lookup_context.update_details(details)
options
end
def _normalize_details(options)
- details = template_lookup.details
+ details = {}
details[:formats] = Array(options[:format]) if options[:format]
details[:locale] = Array(options[:locale]) if options[:locale]
details