aboutsummaryrefslogtreecommitdiffstats
path: root/test/models
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2014-05-19 12:06:09 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2014-05-19 12:06:09 +0200
commit211ce71400449c7e65cbef8ba9546418a20b3c8f (patch)
tree46715d030772f963621efa600e4a9cf2ee1faf93 /test/models
parent65bf5f101e1105411afe030887fbe203d08dadbd (diff)
downloadrails-211ce71400449c7e65cbef8ba9546418a20b3c8f.tar.gz
rails-211ce71400449c7e65cbef8ba9546418a20b3c8f.tar.bz2
rails-211ce71400449c7e65cbef8ba9546418a20b3c8f.zip
Add GlobalID support for serialization
Diffstat (limited to 'test/models')
-rw-r--r--test/models/person.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/models/person.rb b/test/models/person.rb
new file mode 100644
index 0000000000..6e91e8b9a2
--- /dev/null
+++ b/test/models/person.rb
@@ -0,0 +1,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 \ No newline at end of file