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