Sha256: 1d2284a0cb3d1d05d26b6328ae77647c5bbef8ec9e33a1db7e8e6c5c16cd276b

Contents?: true

Size: 1.59 KB

Versions: 14

Compression:

Stored size: 1.59 KB

Contents

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

module DataMapper
  module Validations
    module Fixtures
      class Company
        #
        # Behaviors
        #

        include DataMapper::Resource

        #
        # Properties
        #

        property :id,       Serial
        property :title,    String
        property :type,     Discriminator


        #
        # Validations
        #

        validates_presence_of :title, :message => "Company name is a required field"

      end

      class ServiceCompany < Company

        #
        # Properties
        #

        without_auto_validations do
          property :area_of_expertise, String, :length => (1..60)
        end

        #
        # Validations
        #

        validates_presence_of :area_of_expertise
      end

      class ProductCompany < Company

        #
        # Properties
        #

        without_auto_validations do
          property :flagship_product, String, :length => (1..60)
        end

        #
        # Validations
        #

        validates_presence_of :title, :message => "Product company must have a name"
        validates_presence_of :flagship_product
      end

      class Product
        #
        # Behaviors
        #

        include DataMapper::Resource

        #
        # Properties
        #

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

        #
        # Associations
        #

        belongs_to :company, :model => DataMapper::Validations::Fixtures::ProductCompany

        #
        # Validations
        #

        validates_presence_of :company
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

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