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