-
-
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
Add inverse_of
to order.payments
#1406
Add inverse_of
to order.payments
#1406
Conversation
This doesn't seem to happen automatically and is more important now that we're using cached association objects in OrderUpdater (see Solidus PR 1389). Solidus 1.4 broke some of our specs without it. In a Solidus sandbox without this patch: >> o = Spree::Order.create! >> p = o.payments.create! >> puts p.order.object_id, o.object_id 70240633410460 70240634674300 With this patch: >> o = Spree::Order.create! >> p = o.payments.create! >> puts p.order.object_id, o.object_id 70145793491740 70145793491740 There is some important history around this particular `inverse_of` -- see solidusio/solidus PR 407 and spree/spree_gateway PR 132. Commit d7b8c73 in Solidus removed part of the specs around this, assuming that the `inverse_of` was automatically added, but it doesn't actually seem to be (see above). The remaining tests around the issue still pass.
👍 it's time to do this. We probably can also drop the |
I'm good on this too, thanks jordan 👍 |
See code comments in spec.
I've gone ahead and removed the reload mentioned by @jhawthorn and added some more comments on the specs for that. Assuming specs go green I'll merge this. Shall we backport this to 1.4 as well? |
…t-inverse-of Add `inverse_of` to order.payments
Merge pull request solidusio#1406 from jordan-brough/add-order-payment-inverse-of
For those who are investigating this issue be sure to also look at what impact this PR had by reviewing #1416 |
…t-inverse-of Add `inverse_of` to order.payments
This doesn't seem to happen automatically and is more important now
that we're using cached association objects in OrderUpdater (see
#1389). Solidus 1.4 broke some functionality in our app without it. This
after_save
in Payment triggersorder.update!
if the Order or thePayment is complete. That update needs to operate on the in-memory order
object or things can get out of sync.
It seems like this would be worth getting into Solidus 1.4.
In a Solidus sandbox without this patch:
With this patch:
There is some important history around this particular
inverse_of
--see #407 and spree/spree_gateway#132.
Commit d7b8c73 removed part of the specs around this,
assuming that the
inverse_of
was automatically added, but it doesn'tactually seem to be (see above). The remaining tests around the issue
still pass.
I think I need to look further into the details of the prior issues to ensure
that we won't bring back bugs with this. Any extra eyes or thoughts are
appreciated. Any ideas on specs to add with this are also welcome.