Sha256: 4884ac75771acfc6e79145c395754f6e524491cce3b88e00bf9829bc7f297574
Contents?: true
Size: 744 Bytes
Versions: 3
Compression:
Stored size: 744 Bytes
Contents
class SimpleItem < Item # associations belongs_to :account # validations validates_presence_of :account def self.find_conflict(item) Item.all(:conditions => { :type => item.type, :date => item.date, :account_id => item.account_id, :category_id => item.category_id, :position => item.position, }).reject{|x| x.id == item.id}.first end def validate super # validate category unless self.category && self.category.kind == self.type errors.add("category", "the category is not for #{self.type}") end end # featues acts_as_list :scope => [ 'date = #{date}', 'account_id = #{account_id}', 'category_id = #{category_id}', ].join(" AND ") end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
moneyrail-0.1.5 | app/models/simple_item.rb |
moneyrail-0.1.4 | app/models/simple_item.rb |
moneyrail-0.1.2 | app/models/simple_item.rb |