[fixed] ActiveSupport.on_load(:pay)
never runs
#824
-
Update: Fixed! I was still on I've been debugigng why my custom webhook subscribers don't work and finally narrowed it down to the Here's my Pay.setup do |config|
# *snip*
end
require Rails.root.join("app/models/billing.rb")
require Rails.root.join("app/models/billing/hooks.rb")
require Rails.root.join("app/models/billing/hooks/invoice_paid.rb")
require Rails.root.join("app/models/billing/hooks/customer_subscription_updated.rb")
require Rails.root.join("app/models/billing/hooks/customer_subscription_deleted.rb")
ActiveSupport.on_load(:pay) do
Pay::Webhooks.delegator.subscribe "stripe.invoice.paid", Billing::Hooks::InvoicePaid.new
Pay::Webhooks.delegator.subscribe "stripe.customer.subscription.updated", Billing::Hooks::CustomerSubscriptionUpdated.new
Pay::Webhooks.delegator.subscribe "stripe.customer.subscription.deleted", Billing::Hooks::CustomerSubscriptionDeleted.new
end With the above configuration, the If I move the subscriptions outside of the Any idea why this might be the case? And is it safe not to use It's also worth pointing out that I need to manually require the my classes like you see in the example above, or I get the following error:
A bit surprising, as I figured Rails/Zeitwerk typically takes care of loading files. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I was just going to ask if you were on the latest version. Also, Rails should autoload those files under app/models just fine so you shouldn't need to do any of those requires. |
Beta Was this translation helpful? Give feedback.
I was just going to ask if you were on the latest version.
Also, Rails should autoload those files under app/models just fine so you shouldn't need to do any of those requires.