1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Rename class method to_path to _to_path and make it explicit that it is an internal method.

This commit is contained in:
José Valim 2011-07-28 09:56:42 +02:00
parent 1b7db58a06
commit dee8115539
2 changed files with 7 additions and 5 deletions

View file

@ -1227,12 +1227,12 @@ module ActionView
parent_builder.multipart = multipart if parent_builder parent_builder.multipart = multipart if parent_builder
end end
def self.to_path def self._to_path
@_to_path ||= name.demodulize.underscore.sub!(/_builder$/, '') @_to_path ||= name.demodulize.underscore.sub!(/_builder$/, '')
end end
def to_path def to_path
self.class.to_path self.class._to_path
end end
def to_model def to_model

View file

@ -55,11 +55,13 @@ module ActiveModel
# Returns a string identifying the path associated with the object. # Returns a string identifying the path associated with the object.
# ActionPack uses this to find a suitable partial to represent the object. # ActionPack uses this to find a suitable partial to represent the object.
def to_path def to_path
self.class.to_path self.class._to_path
end end
module ClassMethods module ClassMethods #:nodoc:
def to_path # 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 @_to_path ||= begin
element = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(self)) element = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(self))
collection = ActiveSupport::Inflector.tableize(self) collection = ActiveSupport::Inflector.tableize(self)