Sha256: 3e4159adc7d18dfdf27d6d764b3f2dd9806ff82dbcb69811527dc0c3505bc0f7
Contents?: true
Size: 698 Bytes
Versions: 4
Compression:
Stored size: 698 Bytes
Contents
module Tienda class StockLevelAdjustment < ActiveRecord::Base # The orderable item which the stock level adjustment belongs to belongs_to :item, :polymorphic => true # The parent (OrderItem) which the stock level adjustment belongs to belongs_to :parent, :polymorphic => true # Validations validates :description, :presence => true validates :adjustment, :numericality => true validate { errors.add(:adjustment, I18n.t('tienda.activerecord.attributes.stock_level_adjustment.must_be_greater_or_equal_zero')) if adjustment == 0 } # All stock level adjustments ordered by their created date desending scope :ordered, -> { order(:id => :desc) } end end
Version data entries
4 entries across 4 versions & 1 rubygems