diff options
author | Yehuda Katz <wycats@gmail.com> | 2009-08-07 15:00:12 -0300 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2009-08-07 15:00:12 -0300 |
commit | 010a0c92eb573cd4c216c51371356adddfde11cf (patch) | |
tree | 96da751eaf21bcac20818440657b3f38a6687ffc /actionpack/lib/action_view | |
parent | 55575e21655023259d0dae22bc1b148b34168d92 (diff) | |
download | rails-010a0c92eb573cd4c216c51371356adddfde11cf.tar.gz rails-010a0c92eb573cd4c216c51371356adddfde11cf.tar.bz2 rails-010a0c92eb573cd4c216c51371356adddfde11cf.zip |
Rename find_by_parts and find_by_parts? to find and exists?
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/base.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/paths.rb | 10 | ||||
-rw-r--r-- | actionpack/lib/action_view/render/partials.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/render/rendering.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_view/template/resolver.rb | 2 |
5 files changed, 10 insertions, 10 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 9e696af83b..7932f01ebb 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -202,7 +202,7 @@ module ActionView #:nodoc: delegate :logger, :to => :controller, :allow_nil => true - delegate :find_by_parts, :to => :view_paths + delegate :find, :to => :view_paths include Context diff --git a/actionpack/lib/action_view/paths.rb b/actionpack/lib/action_view/paths.rb index 074b475819..4001757a9b 100644 --- a/actionpack/lib/action_view/paths.rb +++ b/actionpack/lib/action_view/paths.rb @@ -33,12 +33,12 @@ module ActionView #:nodoc: super(*objs.map { |obj| self.class.type_cast(obj) }) end - def find_by_parts(path, details = {}, prefix = nil, partial = false) + def find(path, details = {}, prefix = nil, partial = false) # template_path = path.sub(/^\//, '') template_path = path each do |load_path| - if template = load_path.find_by_parts(template_path, details, prefix, partial) + if template = load_path.find(template_path, details, prefix, partial) return template end end @@ -48,11 +48,11 @@ module ActionView #:nodoc: raise ActionView::MissingTemplate.new(self, "#{prefix}/#{path} - #{details.inspect} - partial: #{!!partial}") end - def find_by_parts?(path, extension = nil, prefix = nil, partial = false) + def exists?(path, extension = nil, prefix = nil, partial = false) template_path = path.sub(/^\//, '') each do |load_path| - return true if template = load_path.find_by_parts(template_path, extension, prefix, partial) + return true if template = load_path.find(template_path, extension, prefix, partial) end false end @@ -62,7 +62,7 @@ module ActionView #:nodoc: template_path = original_template_path.sub(/^\//, '') each do |load_path| - if template = load_path.find_by_parts(template_path, format) + if template = load_path.find(template_path, format) return template # Try to find html version if the format is javascript elsif format == :js && html_fallback && template = load_path["#{template_path}.#{I18n.locale}.html"] diff --git a/actionpack/lib/action_view/render/partials.rb b/actionpack/lib/action_view/render/partials.rb index 48cba9c02b..c559a572b0 100644 --- a/actionpack/lib/action_view/render/partials.rb +++ b/actionpack/lib/action_view/render/partials.rb @@ -258,7 +258,7 @@ module ActionView def _pick_partial_template(partial_path) #:nodoc: prefix = controller_path unless partial_path.include?(?/) - find_by_parts(partial_path, {:formats => formats}, prefix, true) + find(partial_path, {:formats => formats}, prefix, true) end end end diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb index 9c25fab6bb..742b965556 100644 --- a/actionpack/lib/action_view/render/rendering.rb +++ b/actionpack/lib/action_view/render/rendering.rb @@ -24,10 +24,10 @@ module ActionView return _render_content(_render_partial(options), layout, options[:locals]) end - layout = find_by_parts(layout, {:formats => formats}) if layout + layout = find(layout, {:formats => formats}) if layout if file = options[:file] - template = find_by_parts(file, {:formats => formats}) + template = find(file, {:formats => formats}) _render_template(template, layout, :locals => options[:locals] || {}) elsif inline = options[:inline] _render_inline(inline, layout, options) diff --git a/actionpack/lib/action_view/template/resolver.rb b/actionpack/lib/action_view/template/resolver.rb index d15f53a11b..ebfc6cc8ce 100644 --- a/actionpack/lib/action_view/template/resolver.rb +++ b/actionpack/lib/action_view/template/resolver.rb @@ -10,7 +10,7 @@ module ActionView end # Normalizes the arguments and passes it on to find_template - def find_by_parts(*args) + def find(*args) find_all_by_parts(*args).first end |