Browse files

Rename class method to_path to _to_path and make it explicit that it …

…is an internal method.
  • Loading branch information...
1 parent 1b7db58 commit dee81155395658880ea125426036425250849298 @josevalim josevalim committed Jul 28, 2011
Showing with 7 additions and 5 deletions.
  1. +2 −2 actionpack/lib/action_view/helpers/form_helper.rb
  2. +5 −3 activemodel/lib/active_model/conversion.rb
View
4 actionpack/lib/action_view/helpers/form_helper.rb
@@ -1227,12 +1227,12 @@ def multipart=(multipart)
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
View
8 activemodel/lib/active_model/conversion.rb
@@ -55,11 +55,13 @@ def to_param
# 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)

0 comments on commit dee8115

Please sign in to comment.