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