to_model

to_model()
Instance Public methods

If your object is already designed to implement all of the Active Model you can use the default :to_model implementation, which simply returns self.

class Person
  include ActiveModel::Conversion
end

person = Person.new
person.to_model == person # => true

If your model does not act like an Active Model object, then you should define :to_model yourself returning a proxy object that wraps your object with Active Model compliant methods.

doc_ruby_on_rails
2015-06-20 00:00:00
Comments
Leave a Comment

Please login to continue.