Module: ActiveModel::Conversion::ClassMethods

Defined in:
lib/active_model/conversion.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#_to_partial_pathObject

Provide a class level cache for #to_partial_path. This is an internal method and should not be accessed directly.



110
111
112
113
114
115
116
117
118
# File 'lib/active_model/conversion.rb', line 110

def _to_partial_path # :nodoc:
  @_to_partial_path ||= if respond_to?(:model_name)
    "#{model_name.collection}/#{model_name.element}"
  else
    element = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(name))
    collection = ActiveSupport::Inflector.tableize(name)
    "#{collection}/#{element}"
  end
end