0

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!

elias_t
  • 83
  • 2
  • 8

2 Answers2

1

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.

Brandan
  • 14,735
  • 3
  • 56
  • 71
  • Thank you for your answer!Well i have a user model made with devise.In this model a i have a pro boolean.I want user to subscribe and get the pro boolean to true for a month.I think is simple implemetation! – elias_t Apr 20 '12 at 13:32
  • Thanks Brandan!So i have to make this modeling whith the rspreedly gem!Thanks – elias_t Apr 20 '12 at 13:43
0

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

Dmitry Polyakovsky
  • 1,535
  • 11
  • 31