Sha256: 25aa39e62dfb7c68d5e0d3d8a3ea762174a84350960dff8f04a468bf5b913de4
Contents?: true
Size: 1.6 KB
Versions: 2
Compression:
Stored size: 1.6 KB
Contents
# -*- coding: utf-8 -*- module DataMapper module Validate module Fixtures class Company # # Behaviors # include DataMapper::Resource # # Properties # property :id, Serial property :title, String property :type, Discriminator # # Validations # validates_present :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_present :area_of_expertise end class ProductCompany < Company # # Properties # without_auto_validations do property :flagship_product, String, :length => (1..60) end # # Validations # validates_present :title, :message => "Product company must have a name" validates_present :flagship_product end ProductCompany.auto_migrate! class Product # # Behaviors # include DataMapper::Resource # # Properties # property :id, Serial property :name, String, :nullable => false # # Associations # belongs_to :company, :model => DataMapper::Validate::Fixtures::ProductCompany # # Validations # validates_present :company end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dm-validations-0.10.1 | spec/fixtures/company.rb |
dm-validations-0.10.0 | spec/fixtures/company.rb |