module ActionView::ModelNaming

Public Instance Methods

convert_to_model(object) Show source
# File actionview/lib/action_view/model_naming.rb, line 4
def convert_to_model(object)
  object.respond_to?(:to_model) ? object.to_model : object
end

Converts the given object to an ActiveModel compliant one.

model_name_from_record_or_class(record_or_class) Show source
# File actionview/lib/action_view/model_naming.rb, line 8
def model_name_from_record_or_class(record_or_class)
  convert_to_model(record_or_class).model_name
end

© 2004–2018 David Heinemeier Hansson
Licensed under the MIT License.