negos_app/app/models/binary_point.rb
2016-02-16 21:09:48 +01:00

23 lines
351 B
Ruby
Executable File

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