class Commission < ActiveRecord::Base belongs_to :customer has_one :order_solde, :class_name => "Order" belongs_to :order belongs_to :count_part_com has_one :virement after_create do if self.commission_type_id == 1 or self.commission_type_id == 2 or self.commission_type_id == 3 CustomerMailer.new_commission(self).deliver end end end