blob: 5056bf98126d8e8393b53d51e9326ecd1f282006 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
class Movie
attr_accessor :id, :name, :studio
def ==(other)
return false unless other
return false if other.id == -1
return false if @id == -1
@id == other.id
end
end
class MovieMapping < Humble::DatabaseMapping
def run(map)
map.table :movies
map.type Movie
map.primary_key(:id, default: -1)
map.column :name
map.belongs_to :studio_id, Studio
end
end
|