blob: 8e6bcb7af85241eafaa69eb0c167c71fd6067bd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
class Movie
attr_accessor :id, :name, :studio, :reviews
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
map.has_many :reviews, Review
end
end
|