diff options
author | Yehuda Katz <wycats@gmail.com> | 2009-01-22 16:18:10 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-01-22 16:18:10 -0600 |
commit | eb9af20b7cc0e374277cf330bdd404f9daab28ec (patch) | |
tree | ba05a906690684e442ed92db3e63e295f0dd133e /actionpack/lib/action_view/paths.rb | |
parent | cc0b5fa9930dcc60914e21b518b3c54109243cfa (diff) | |
download | rails-eb9af20b7cc0e374277cf330bdd404f9daab28ec.tar.gz rails-eb9af20b7cc0e374277cf330bdd404f9daab28ec.tar.bz2 rails-eb9af20b7cc0e374277cf330bdd404f9daab28ec.zip |
Begin unifying the interface between ActionController and ActionView
Diffstat (limited to 'actionpack/lib/action_view/paths.rb')
-rw-r--r-- | actionpack/lib/action_view/paths.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/paths.rb b/actionpack/lib/action_view/paths.rb index 19207e7262..4c3a226ac6 100644 --- a/actionpack/lib/action_view/paths.rb +++ b/actionpack/lib/action_view/paths.rb @@ -32,14 +32,24 @@ module ActionView #:nodoc: super(*objs.map { |obj| self.class.type_cast(obj) }) end + def find_by_parts(path, extension = nil, prefix = nil, partial = false) + template_path = path.sub(/^\//, '') + + each do |load_path| + if template = load_path.find_by_parts(template_path, extension, prefix, partial) + return template + end + end + + Template.new(path, self) + end + def find_template(original_template_path, format = nil) return original_template_path if original_template_path.respond_to?(:render) template_path = original_template_path.sub(/^\//, '') each do |load_path| - if format && (template = load_path["#{template_path}.#{format}"]) - return template - elsif template = load_path[template_path] + if template = load_path.find_by_parts(template_path, format) return template end end |