Sha256: 0e520d11eb55191e3c704127f429d80626f288bb49f82f73befbff8ee2c4b88e
Contents?: true
Size: 1.59 KB
Versions: 4
Compression:
Stored size: 1.59 KB
Contents
# -*- coding: utf-8 -*- module DataMapper module Validation 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
4 entries across 4 versions & 2 rubygems