Class: Move

Inherits:
Item
  • Object
show all
Defined in:
app/models/move.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Item

#before_validation

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_to => item.,
    :category_id => item.category_id,
    :position => item.position,
  }).reject{|x| x.id == item.id}.first
end

Instance Method Details

#validateObject



22
23
24
25
26
27
# File 'app/models/move.rb', line 22

def validate
  if  == 
    errors.add("account_id_from", "from and to must not be same")
  end
  super
end