aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-07-28 09:56:42 +0200
committerJosé Valim <jose.valim@gmail.com>2011-07-28 09:56:42 +0200
commitdee81155395658880ea125426036425250849298 (patch)
tree144ef0c56a418b0bf60dd9d5bfdc50b1d8482843
parent1b7db58a0604b01cd5c3a8d73b11158a48e45772 (diff)
downloadrails-dee81155395658880ea125426036425250849298.tar.gz
rails-dee81155395658880ea125426036425250849298.tar.bz2
rails-dee81155395658880ea125426036425250849298.zip
Rename class method to_path to _to_path and make it explicit that it is an internal method.
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb4
-rw-r--r--activemodel/lib/active_model/conversion.rb8
2 files changed, 7 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index 7ea2ea2d5a..85dea96bbb 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
+ def self._to_path
@_to_path ||= name.demodulize.underscore.sub!(/_builder$/, '')
end
def to_path
- self.class.to_path
+ self.class._to_path
end
def to_model
diff --git a/activemodel/lib/active_model/conversion.rb b/activemodel/lib/active_model/conversion.rb
index dca1c1aa44..39977f12c3 100644
--- a/activemodel/lib/active_model/conversion.rb
+++ b/activemodel/lib/active_model/conversion.rb
@@ -55,11 +55,13 @@ module ActiveModel
# Returns a string identifying the path associated with the object.
# ActionPack uses this to find a suitable partial to represent the object.
def to_path
- self.class.to_path
+ self.class._to_path
end
- module ClassMethods
- def to_path
+ module ClassMethods #:nodoc:
+ # Provide a class level cache for the to_path. This is an
+ # internal method and should not be accessed directly.
+ def _to_path #:nodoc:
@_to_path ||= begin
element = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(self))
collection = ActiveSupport::Inflector.tableize(self)