Make sure QB subscriptions reload properly in dev
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user