mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
28 lines
470 B
Ruby
28 lines
470 B
Ruby
|
class User
|
||
|
include ::DataMapper::Resource
|
||
|
|
||
|
property :id, Serial
|
||
|
property :name, String, :required => true
|
||
|
property :age, Integer
|
||
|
|
||
|
has n, :projects, :through => Resource
|
||
|
end
|
||
|
|
||
|
class User::Address
|
||
|
include ::DataMapper::Resource
|
||
|
|
||
|
property :id, Serial
|
||
|
end
|
||
|
|
||
|
class Project
|
||
|
include ::DataMapper::Resource
|
||
|
|
||
|
property :id, Serial
|
||
|
property :name, String, :required => true
|
||
|
|
||
|
has n, :users, :through => Resource
|
||
|
end
|
||
|
|
||
|
DataMapper.finalize
|
||
|
DataMapper.auto_migrate!
|