Sha256: 53cfac573ec28e858e8469054bfa8ad3ac45bdd6fe87bbc3506228df50193e49
Contents?: true
Size: 803 Bytes
Versions: 1
Compression:
Stored size: 803 Bytes
Contents
class Product < ActiveRecord::Base validates_presence_of :title validates_inclusion_of :price, :in => 0..99, :unless => :tangible validates_exclusion_of :weight, :in => 10..100, :unless => :tangible validates_format_of :size, :with => /^\d+\D+$/, :unless => :tangible validates_presence_of :price, :if => :tangible validates_inclusion_of :price, :in => 1..9999, :if => :tangible, :allow_nil => true validates_inclusion_of :weight, :in => 1..100, :if => :tangible, :allow_blank => true validates_inclusion_of :size, :in => %w(S M L XL), :if => :tangible, :allow_blank => true validates_exclusion_of :size, :in => %w(XS XM), :if => :tangible validates_length_of :size, :in => 5..20, :if => :tangible, :allow_blank => true end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
carlosbrando-remarkable-2.2.1 | spec/rails_root/app/models/product.rb |