Sha256: a83f9208a4117f9ede889c200ff912d32750d74d8a66b7b71ea879f183db345b
Contents?: true
Size: 1.04 KB
Versions: 17
Compression:
Stored size: 1.04 KB
Contents
require 'dm-core' require 'dm-validations' require 'dm-aggregates' DataMapper.setup(:default, 'sqlite3::memory:') # Fake Category Model class Category include DataMapper::Resource property :id, Serial property :name, String belongs_to :account end # Fake Account Model class Account include DataMapper::Resource property :id, Serial property :name, String has n, :categories def self.admin; first(:role => "Admin"); end def self.editor; first(:role => "Editor"); end end Padrino::Admin::Orm.register! DataMapper.auto_migrate! # We build some fake accounts admin = Account.create(:name => "DAddYE", :role => "Admin", :email => "d.dagostino@lipsiasoft.com", :password => "some", :password_confirmation => "some") editor = Account.create(:name => "Dexter", :role => "Editor", :email => "editor@lipsiasoft.com", :password => "some", :password_confirmation => "some") %w(News Press HowTo).each do |c| admin.categories.create(:name => c) editor.categories.create(:name => c) end
Version data entries
17 entries across 17 versions & 1 rubygems