-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert product, variant, stock item, prices to discard #2396
Conversation
core/app/models/spree/product.rb
Outdated
def paranoia_destroy | ||
Spree::Deprecation.warn <<-WARN.strip_heredoc | ||
Calling #destroy (or #paranoia_destroy) on a Product currently performs a soft-destroy using the paranoia gem. | ||
In Solidus 3.0, paranoia will be removed, and this will perform a HARD destoy instead. To continue soft-deleting, use #discard instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"...perform a HARD destoy". All three of the deprecation warnings have this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also prompted me to move these warnings to a common ParanoiaDeprecations
module.
b0202c6
to
94f675d
Compare
94f675d
to
aa41298
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Just left a comment on a possible mistake.
|
||
it "should keep its price if deleted" do | ||
expect(variant.display_price).to eq(previous_variant_price) | ||
variant.destroy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't be variant.discard
?
0796699
to
cc59d0e
Compare
cc59d0e
to
2b1890a
Compare
This deprecates the #paranoia_destroy (and therefore also #destroy) method on these models in favour of using #discard. after_discard callbacks have been added to these models to duplicate the current behaviour of calling #destroy (before_destroy callbacks and destroying of dependent: :destroy associations).
2b1890a
to
b6e8236
Compare
This deprecates the
#paranoia_destroy
(and therefore also#destroy
) method on these models in favour of using #discard.after_discard
callbacks have been added to these models to duplicate the exact current behaviour of calling#destroy
(before_destroy
callbacks and destroying ofdependent: :destroy
associations). In the future we probably want to change this behaviour (why do we delete images when soft-deleting variants?), but that isn't being done here.