aboutsummaryrefslogtreecommitdiffstats
path: root/test/models/person.rb
blob: 6e91e8b9a2a7bb8e5b7faa7f001bc2ba34bfa98d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require 'active_model/global_identification'

class Person
  include ActiveModel::GlobalIdentification
  
  attr_reader :id
  
  def self.find(id)
    new(id)
  end
  
  def initialize(id)
    @id = id
  end
  
  def ==(other_person)
    other_person.is_a?(Person) && id = other_person.id
  end
end