aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/models/contact.rb
blob: 605e435f39869e1ba3856ecf4dd2cb8fff2a7c69 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class Contact
  include ActiveModel::Conversion

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

  def social
    %w(twitter github)
  end

  def network
    {:git => :github}
  end

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

  def persisted?
    id
  end
end