Make sure QB subscriptions reload properly in dev

This commit is contained in:
Mike Dalessio
2025-06-25 09:20:50 -04:00
parent 65b5f10ceb
commit b2ff0b47bf
2 changed files with 15 additions and 5 deletions
+9 -5
View File
@@ -1,9 +1,13 @@
class Subscription < Queenbee::Subscription
SHORT_NAMES = %w[ FreeV1 ]
end
class FreeV1Subscription < Subscription
property :proper_name, "Free Subscription"
property :price, 0
property :frequency, "yearly"
def self.short_name
name.demodulize
end
class FreeV1 < Subscription
property :proper_name, "Free Subscription"
property :price, 0
property :frequency, "yearly"
end
end
+6
View File
@@ -3,4 +3,10 @@ Queenbee.host_app = Fizzy
Rails.application.config.to_prepare do
Queenbee::Subscription.short_names = Subscription::SHORT_NAMES
Queenbee::ApiToken.token = Rails.application.credentials.dig(:queenbee_api_token)
Subscription::SHORT_NAMES.each do |short_name|
const_name = "#{short_name}Subscription"
::Object.send(:remove_const, const_name) if ::Object.const_defined?(const_name)
::Object.const_set const_name, Subscription.const_get(short_name, false)
end
end