diff options
author | José Valim <jose.valim@gmail.com> | 2011-08-01 11:42:00 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-08-01 11:42:00 +0200 |
commit | dc8773b19f61af2ba818d66923fc65e17bad6c20 (patch) | |
tree | bfc4089cd48db0caeddd550dc56db49b799ee1e0 /actionpack | |
parent | d701b3fa470b53a56da131cf64b96e411178bc08 (diff) | |
download | rails-dc8773b19f61af2ba818d66923fc65e17bad6c20.tar.gz rails-dc8773b19f61af2ba818d66923fc65e17bad6c20.tar.bz2 rails-dc8773b19f61af2ba818d66923fc65e17bad6c20.zip |
Rename new method to_path to to_partial_path to avoid conflicts with File#to_path and similar.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 8 | ||||
-rw-r--r-- | actionpack/lib/action_view/renderer/partial_renderer.rb | 6 | ||||
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/render_test.rb | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 85dea96bbb..f22c466666 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -1227,12 +1227,12 @@ module ActionView parent_builder.multipart = multipart if parent_builder end - def self._to_path - @_to_path ||= name.demodulize.underscore.sub!(/_builder$/, '') + def self._to_partial_path + @_to_partial_path ||= name.demodulize.underscore.sub!(/_builder$/, '') end - def to_path - self.class._to_path + def to_partial_path + self.class._to_partial_path end def to_model diff --git a/actionpack/lib/action_view/renderer/partial_renderer.rb b/actionpack/lib/action_view/renderer/partial_renderer.rb index f67388b8cf..cd0f7054a9 100644 --- a/actionpack/lib/action_view/renderer/partial_renderer.rb +++ b/actionpack/lib/action_view/renderer/partial_renderer.rb @@ -364,10 +364,10 @@ module ActionView def partial_path(object = @object) object = object.to_model if object.respond_to?(:to_model) - path = if object.respond_to?(:to_path) - object.to_path + path = if object.respond_to?(:to_partial_path) + object.to_partial_path else - ActiveSupport::Deprecation.warn "ActiveModel-compatible objects whose classes return a #model_name that responds to #partial_path are deprecated. Please respond to #to_path directly instead." + ActiveSupport::Deprecation.warn "ActiveModel-compatible objects whose classes return a #model_name that responds to #partial_path are deprecated. Please respond to #to_partial_path directly instead." object.class.model_name.partial_path end diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 71a2c46d92..f898c22e1e 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -1895,7 +1895,7 @@ class FormHelperTest < ActionView::TestCase path = nil form_for(@post, :builder => LabelledFormBuilder) do |f| - path = f.to_path + path = f.to_partial_path '' end diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb index 0b91e55091..6f02f8662d 100644 --- a/actionpack/test/template/render_test.rb +++ b/actionpack/test/template/render_test.rb @@ -214,14 +214,14 @@ module RenderTestCases end def test_render_partial_using_object_with_deprecated_partial_path - assert_deprecated(/#model_name.*#partial_path.*#to_path/) do + assert_deprecated(/#model_name.*#partial_path.*#to_partial_path/) do assert_equal "Hello: nertzy", @controller_view.render(CustomerWithDeprecatedPartialPath.new("nertzy"), :greeting => "Hello") end end def test_render_partial_using_collection_with_deprecated_partial_path - assert_deprecated(/#model_name.*#partial_path.*#to_path/) do + assert_deprecated(/#model_name.*#partial_path.*#to_partial_path/) do customers = [ CustomerWithDeprecatedPartialPath.new("nertzy"), CustomerWithDeprecatedPartialPath.new("peeja") |