1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00
kaminari--kaminari/spec/fake_app/data_mapper/models.rb
Akira Matsuda d0cb1837a1 refactor AR, DM, mongoid, and mongo_mapper specs
extract model definitions for each ORM under spec/fake_app, and load them only if target ORM is loaded
by this mechanism, all ORMs share a model name "User", and the other specs such as helper specs and request specs will run polymorphically
2012-05-23 12:44:13 +09:00

27 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!