module ActiveModel::Model
def initialize(attributes = {})
person.name # => "bob"
person = Person.new(name: 'bob', age: '18')
end
attr_accessor :name, :age
include ActiveModel::Model
class Person
Initializes a new model with the given +params+.
def initialize(attributes = {}) assign_attributes(attributes) if attributes super() end
def persisted?
person = Person.new(id: 1, name: 'bob')
end
attr_accessor :id, :name
include ActiveModel::Model
class Person
Indicates if the model is persisted. Default is +false+.
def persisted? false end