stripe-rails
stripe-rails copied to clipboard
after_stripe_event! not called after code reload
include Stripe::Callbacks
after_stripe_event! do |target, event|
Billing::Event.create!(stripe_id: event.id, kind: event.type, data: event.to_hash)
end
The code above works well after the app restart. Once I modify the code the app gets reloaded and the callback is never called again.
Can reproduce from rails console
3.1.1 :002 > ::Stripe::Callbacks::critical_callbacks
=> {"stripe.event"=>[#<Proc:0x00000001163479b8 /Users/heaven/Workspace/mdc/app/models/member.rb:30>]}
3.1.1 :003 > reload!
Reloading...
=> true
3.1.1 :004 > ::Stripe::Callbacks::critical_callbacks
=> {}
To reproduce the problem config.eager_load should be true in development.
Rails: 7.0.2 Rails env: development Stripe: 6.5.0 (same with 6.1.0) Stripe Rails: 2.3.4
Same issue here. I was going crazy trying to figure out why the callbacks aren't showing up. Probably going to switch back to the basic Stripe gem until this is fixed.
This is a quite serious issue and breaks the development process completely. Can anyone have a look, please? All versions starting from 2.0.0 are affected.
Hi folks, I'm currently busy with work right now and won't have time to look at this for at least a few more weeks. If you'd like to take a stab at this, I'll be happy to look at your PR!
Here are some past work on this that might point to why it's broken right now,
- https://github.com/tansengming/stripe-rails/pull/137
- https://github.com/tansengming/stripe-rails/pull/159
+1