Class: Move
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Item
Class Method Details
.find_conflict(item) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/models/move.rb', line 12 def self.find_conflict(item) Move.all(:conditions => { :date => item.date, :account_id_from => item.account_id_from, :account_id_to => item.account_id_to, :category_id => item.category_id, :position => item.position, }).reject{|x| x.id == item.id}.first end |
Instance Method Details
#validate ⇒ Object
22 23 24 25 26 27 |
# File 'app/models/move.rb', line 22 def validate if account_id_from == account_id_to errors.add("account_id_from", "from and to must not be same") end super end |