class BinaryPoint < ActiveRecord::Base
  belongs_to :annonce_account
  belongs_to :order


  scope :left, lambda {
    where(:side => 1)
  }
  
  scope :right, lambda {
    where(:side => 2)
  }
  
  after_save do
    if self.side == 1 
      self.annonce_account.update_left_binary_points
    else
      self.annonce_account.update_right_binary_points
    end
  end

end