foodsoft/app/models/stock_taking.rb
benni 46450cebef New annotation, because of db switch to mysql.
Background: sqlite has some problems with decimal option.
2011-05-07 21:55:24 +02:00

24 lines
551 B
Ruby

class StockTaking < ActiveRecord::Base
has_many :stock_changes, :dependent => :destroy
has_many :stock_articles, :through => :stock_changes
validates_presence_of :date
def stock_change_attributes=(stock_change_attributes)
for attributes in stock_change_attributes
stock_changes.build(attributes) unless attributes[:quantity].to_i == 0
end
end
end
# == Schema Information
#
# Table name: stock_takings
#
# id :integer(4) not null, primary key
# date :date
# note :text
# created_at :datetime
#