negos_app/app/models/binary_point.rb
Nicolas Bally 772e87ffb7 initial
2015-11-14 00:08:54 +01:00

23 lines
351 B
Ruby

class BinaryPoint < ActiveRecord::Base
belongs_to :customer
belongs_to :order
scope :left, lambda {
where(:side => 1)
}
scope :right, lambda {
where(:side => 2)
}
after_save do
if self.side == 1
self.customer.update_left_binary_points
else
self.customer.update_right_binary_points
end
end
end