aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/models/contact.rb
blob: dbdb8539b79c67bd3488129c478b19eaa0891433 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
class Contact
  include ActiveModel::Conversion

  attr_accessor :id, :name, :age, :created_at, :awesome, :preferences, :new_record

  def initialize(options = {})
    options.each { |name, value| send("#{name}=", value) }
  end

  def new_record?
    defined?(@new_record) ? @new_record : true
  end
end