Sha256: e498c5beb09ad3b3a4506f23a5925d22d26417f168ab6512826cf2b7ccc2c332
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
require 'dm-core' require 'dm-validations' 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::Adapters.register(:datamapper) 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
padrino-admin-0.6.3 | test/fixtures/data_mapper.rb |
padrino-admin-0.6.2 | test/fixtures/data_mapper.rb |
padrino-admin-0.6.1 | test/fixtures/data_mapper.rb |