Rails 4.1, initializers, and secrets.yml

Posted by – April 9, 2014

I'm using 4.1 on a new project. When I tried to set up an initializer using the values in secrets.yml, I got this error:


/Users/barry/.rvm/gems/ruby-2.1.1@rails4.1/gems/railties-4.1.0.rc2/lib/rails/application.rb:311:in `secrets': uninitialized constant Rails::Application::YAML (NameError)
from /Users/barry/projects/archiv8-billing/config/initializers/chargify.rb:2:in `block in '
from /Users/barry/.rvm/gems/ruby-2.1.1@rails4.1/gems/chargify_api_ares-1.0.4/lib/chargify_api_ares/config.rb:6:in `configure'
from /Users/barry/projects/archiv8-billing/config/initializers/chargify.rb:1:in `
'

I fixed it by adding require 'yaml' to the top of my initializer:


require 'yaml'
Chargify.configure do |c|
  c.api_key   = Rails.application.secrets.chargify_key
  c.subdomain = Rails.application.secrets.chargify_subdomain
end
0 Comments on Rails 4.1, initializers, and secrets.yml

Respond

Respond

Comments

Comments