Sha256: ee986ffac92f0a3b9851597f517fa7efb1f1b0d92bb90156ca2b2e9d7b698495
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
DataMapper.setup :default, 'sqlite::memory:' class Author include DataMapper::Resource property :id, Serial property :name, String end class Genre include DataMapper::Resource property :id, Serial property :name, String has n, :books, through: Resource end class Book include DataMapper::Resource property :id, Serial property :name, String property :about, Text property :cover, String property :colors, String property :created_at, Date belongs_to :author, required: false has n, :genres, through: Resource end class State include DataMapper::Resource property :id, Serial property :name, String, index: true property :code, String, unique: true, length: 2 has n, :cities, child_key: :state_code, parent_key: :code end class City include DataMapper::Resource property :id, Serial property :name, String, index: true belongs_to :state, child_key: :state_code, parent_key: :code, required: false end DataMapper.finalize DataMapper.auto_migrate!
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rear-0.2.0 | test/models/dm.rb |