Skip to content

Commit

Permalink
Remove Paranoia from Price model
Browse files Browse the repository at this point in the history
Remove Paranoia and leave Discard as the only option for soft-deleting
the records.
  • Loading branch information
cedum committed Jan 24, 2020
1 parent 85cccb5 commit d2573bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/app/models/concerns/spree/default_price.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module DefaultPrice

included do
has_one :default_price,
-> { with_deleted.currently_valid.with_default_attributes },
-> { with_discarded.currently_valid.with_default_attributes },
class_name: 'Spree::Price',
inverse_of: :variant,
dependent: :destroy,
Expand Down
5 changes: 2 additions & 3 deletions core/app/models/spree/price.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

module Spree
class Price < Spree::Base
acts_as_paranoid
include Spree::ParanoiaDeprecations

include Discard::Model
self.discard_column = :deleted_at

default_scope { kept }

MAXIMUM_AMOUNT = BigDecimal('99_999_999.99')

belongs_to :variant, -> { with_discarded }, class_name: 'Spree::Variant', touch: true, optional: true
Expand Down

0 comments on commit d2573bb

Please sign in to comment.