Skip to content
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

Deprecation warning of paranoia delete #2744

Closed
denis-mueller opened this issue May 24, 2018 · 3 comments
Closed

Deprecation warning of paranoia delete #2744

denis-mueller opened this issue May 24, 2018 · 3 comments

Comments

@denis-mueller
Copy link

denis-mueller commented May 24, 2018

def paranoia_delete
Spree::Deprecation.warn <<-WARN.strip_heredoc, caller
Calling #delete (or #paranoia_delete) on a #{self.class} currently performs a soft-destroy using the paranoia gem.
In Solidus 3.0, paranoia will be removed, and this will perform a HARD destroy instead. To continue soft-deleting, use #discard instead.
WARN
super
end

Gemfile: https://gist.github.com/denis-mueller/d62712801b730f5d6829ea4070376335
Gemfile.lock: https://gist.github.com/denis-mueller/b5bf01f2261601ebb2c2739674a27b15

By setting the prices for a Product's Variant, the old prices get deleted (because the Variant has many Prices with dependent: destroy)

      product.master.prices = [
        create(:price, amount: 4, currency: 'CHF'),
        create(:price, amount: 5, currency: 'EUR')
      ]

This prints out the following deprecation warning:

DEPRECATION WARNING: Calling #delete (or #paranoia_delete) on a Spree::Price currently performs a soft-destroy using the paranoia gem.
In Solidus 3.0, paranoia will be removed, and this will perform a HARD destroy instead. To continue soft-deleting, use #discard instead.

What can I do so that I don't get the deprecation warning anymore?

@kennyadsl
Copy link
Member

@denis-mueller I think it's an issue with the discard gem, and I've opened an issue there. Let's see what's the best way to move forward on this and thanks for pointing out the issue.

@kennyadsl
Copy link
Member

For now, if you want to remove the warning, you can do something like:

product.master.prices.discard_all
product.master.prices = [
  create(:price, amount: 4, currency: 'CHF'),
  create(:price, amount: 5, currency: 'EUR')
]

Let me know if this works!

@jarednorman
Copy link
Member

With no activity in over a year, I think we can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants