Sha256: 08aa2450a6889883cfc444f2906398fa8a63438609c2d0074a73820ff2626d1f
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
# -*- coding: utf-8 -*- if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES module DataMapper module Validate module Fixtures class Organisation include DataMapper::Resource property :id, Serial property :name, String property :domain, String, :unique_index => true validates_is_unique :domain, :allow_nil => true auto_migrate! end class Department include DataMapper::Resource property :id, Serial property :name, String, :unique_index => true validates_is_unique :name auto_migrate! end class User include DataMapper::Resource property :id, Serial property :user_name, String belongs_to :organisation belongs_to :department validates_is_unique :user_name, :when => :signing_up_for_department_account, :scope => [:department] validates_is_unique :user_name, :when => :signing_up_for_organization_account, :scope => [:organisation] auto_migrate! end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dm-validations-0.10.1 | spec/fixtures/corporate_world.rb |
dm-validations-0.10.0 | spec/fixtures/corporate_world.rb |