mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Default scope for BPs ignores deleted records
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user