Search code examples
ruby-on-railsrubyrails-apitrello

Where I need to place ruby-trello gem's config code?


I am creating rails API app for managing Trello related boards and lists. I have decided to use "ruby-trello" gem.

There is a config example at github ruby-trello page (https://github.com/jeremytregunna/ruby-trello).

Config looks like this:

Trello.configure do |config|
  config.developer_public_key = 'my_trello_key'
  config.member_token = 'my_trello_token'
end

I got key and token from trello devs. I have added this code to my config/application.rb in class Application. But when I am trying to get something data from Trello I see this error:

Trello::ConfigurationError (Trello has not been configured to make authorized requests.)

Can anybody help? Where I need to place this config code?

Sorry for my English.


Solution

  • The Rails convention is to put that in config/initializers/trello.rb so that it's picked up when Rails boots.

    It's odd they don't seem to mention that in the documentation.