Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 250c809246
Fetching contributors…

Cannot retrieve contributors at this time

30 lines (21 sloc) 0.427 kB
require 'active_model'
class Person
include ActiveModel::Conversion
include ActiveModel::Validations
validates_presence_of :name
attr_accessor :name
def initialize(attributes = {})
@name = attributes[:name]
end
def persist
@persisted = true
end
def persisted?
@persisted
end
end
person1 = Person.new
p person1.valid?
person1.errors
person2 = Person.new(:name => "matz")
p person2.valid?
Jump to Line
Something went wrong with that request. Please try again.