class Commission < ActiveRecord::Base belongs_to :annonce_account has_one :order_solde, :class_name => "Order" belongs_to :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 AnnonceAccountMailer.new_commission(self).deliver end end end