File: person_model.rb

package info (click to toggle)
ruby-globalid 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 316 kB
  • sloc: ruby: 1,695; makefile: 6
file content (20 lines) | stat: -rw-r--r-- 259 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'active_model'

class PersonModel
  include ActiveModel::Model
  include GlobalID::Identification

  attr_accessor :id

  def self.primary_key
    :id
  end

  def self.find(id)
    new id: id
  end

  def ==(other)
    id == other.try(:id)
  end
end