Sha256: da1de4d57133240c426938191f623d8109f864049101c0d6f28310d231247c24

Contents?: true

Size: 975 Bytes

Versions: 14

Compression:

Stored size: 975 Bytes

Contents

# -*- coding: utf-8 -*-

module DataMapper
  module Validations
    module Fixtures
      class Organisation
        include DataMapper::Resource

        property :id, Serial
        property :name, String
        property :domain, String, :unique_index => true

        validates_uniqueness_of :domain, :allow_nil => true
      end

      class Department
        include DataMapper::Resource

        property :id, Serial
        property :name, String, :unique_index => true

        validates_uniqueness_of :name
      end

      class User
        include DataMapper::Resource

        property :id, Serial
        property :user_name, String

        belongs_to :organisation
        belongs_to :department

        validates_uniqueness_of :user_name, :when => :signing_up_for_department_account,   :scope => [:department]
        validates_uniqueness_of :user_name, :when => :signing_up_for_organization_account, :scope => [:organisation]
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
ardm-validations-1.2.0 spec/fixtures/corporate_world.rb
dm-validations-1.2.0 spec/fixtures/corporate_world.rb
dm-validations-1.2.0.rc2 spec/fixtures/corporate_world.rb
dm-validations-1.2.0.rc1 spec/fixtures/corporate_world.rb
dm-validations-1.1.0 spec/fixtures/corporate_world.rb
dm-validations-1.1.0.rc3 spec/fixtures/corporate_world.rb
dm-validations-1.1.0.rc2 spec/fixtures/corporate_world.rb
dm-validations-1.1.0.rc1 spec/fixtures/corporate_world.rb
dm-validations-1.0.2 spec/fixtures/corporate_world.rb
dm-validations-1.0.1 spec/fixtures/corporate_world.rb
dm-validations-1.0.0 spec/fixtures/corporate_world.rb
dm-validations-1.0.0.rc3 spec/fixtures/corporate_world.rb
dm-validations-1.0.0.rc2 spec/fixtures/corporate_world.rb
dm-validations-1.0.0.rc1 spec/fixtures/corporate_world.rb