class Abonnement < ActiveRecord::Base has_many :payments, :as => :element def after_paid self.paid = true self.save end def total_price_ht self.price end def total_price_ttc total_price_ht + total_price_ht * tva end def tva 0.2 end end