diff --git a/app/models/billable_period.rb b/app/models/billable_period.rb index c7fe5fc4fc..9e8009f050 100644 --- a/app/models/billable_period.rb +++ b/app/models/billable_period.rb @@ -2,6 +2,8 @@ class BillablePeriod < ActiveRecord::Base belongs_to :enterprise belongs_to :owner, class_name: 'Spree::User', foreign_key: :owner_id + default_scope where(deleted_at: nil) + def bill # Will make this more sophisicated in the future in that it will use global config variables to calculate return 0 if trial? @@ -12,4 +14,8 @@ class BillablePeriod < ActiveRecord::Base 0 end end + + def delete + self.update_column(:deleted_at, Time.now) + end end