Spreedly gem with rails
-
02-06-2021 - |
سؤال
I want to put spreedly in my new rails app.Because i am newbie can anyone help me with the spreedly gem?It says you must Configure your API key and site name for your account:
RSpreedly::Config.setup do |config|
config.api_key = "your-api-key"
config.site_name = "your-site-name"
end
Where should i put that?I need to make a initializer for this? And then i want to have a subscription system.Should i have to make a controller to handle subscriptions?Please Help!
المحلول
I would put that code in config/initializers/spreedly.rb
.
Without knowing more about your application, it's hard to answer your second question, but I would say: yes.
نصائح أخرى
It might be environment specific so you could do this in initializer
if Rails.env.development?
elseif Rails.env.test?
else
...
Or just put different values in test.rb, develoment.rb and production.rb
لا تنتمي إلى StackOverflow