mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Make tests for Person
pass.
This commit is contained in:
parent
ec47b52b24
commit
6198978fa2
1 changed files with 5 additions and 5 deletions
|
@ -2,18 +2,18 @@ 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
|
||||
other_person.is_a?(Person) && id.to_s == other_person.id.to_s
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue