{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/19853","labels_url":"https://api.github.com/repos/rails/rails/issues/19853/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/19853/comments","events_url":"https://api.github.com/repos/rails/rails/issues/19853/events","html_url":"https://github.com/rails/rails/issues/19853","id":70063240,"number":19853,"title":"Attempting to access secrets in initializers or environment fails","user":{"login":"codyrobbins","id":145600,"avatar_url":"https://avatars.githubusercontent.com/u/145600?v=3","gravatar_id":"","url":"https://api.github.com/users/codyrobbins","html_url":"https://github.com/codyrobbins","followers_url":"https://api.github.com/users/codyrobbins/followers","following_url":"https://api.github.com/users/codyrobbins/following{/other_user}","gists_url":"https://api.github.com/users/codyrobbins/gists{/gist_id}","starred_url":"https://api.github.com/users/codyrobbins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codyrobbins/subscriptions","organizations_url":"https://api.github.com/users/codyrobbins/orgs","repos_url":"https://api.github.com/users/codyrobbins/repos","events_url":"https://api.github.com/users/codyrobbins/events{/privacy}","received_events_url":"https://api.github.com/users/codyrobbins/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-22T08:52:13Z","updated_at":"2015-04-22T19:37:40Z","closed_at":"2015-04-22T19:10:39Z","body":"After upgrading from Rails 4.2.0/Ruby 2.2.1 to Rails 4.2.1/Ruby 2.2.2 I get the following error when attempting to access a secret from `Rails.application.secrets` in an initializer or environment configuration file:\r\n\r\n```\r\nNameError: uninitialized constant Rails::Application::YAML\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:391:in `secrets'\r\n~/apps/foo/config/initializers/foo.rb:1:in `<top (required)>'\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:652:in `block in load_config_initializer'\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166:in `instrument'\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:651:in `load_config_initializer'\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:615:in `each'\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:615:in `block in <class:Engine>'\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `instance_exec'\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run'\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:44:in `each'\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:44:in `tsort_each_child'\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers'\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!'\r\n~/apps/foo/config/environment.rb:5:in `<top (required)>'\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:328:in `require'\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:328:in `require_environment!'\r\n~/apps/foo/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:457:in `block in run_tasks_blocks'\r\n```\r\n\r\nAdding `require('yaml')` in the initializer or environment configuration solves the problem, but YAML should already be being loaded by Rails.\r\n\r\nThe problem is exactly the same as described in [this blog post](http://blog.tristanmedia.com/2014/04/rails-4-1-initializers-and-secrets-yml/) regarding Rails 4.1."},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/95312824","html_url":"https://github.com/rails/rails/issues/19853#issuecomment-95312824","issue_url":"https://api.github.com/repos/rails/rails/issues/19853","id":95312824,"user":{"login":"codyrobbins","id":145600,"avatar_url":"https://avatars.githubusercontent.com/u/145600?v=3","gravatar_id":"","url":"https://api.github.com/users/codyrobbins","html_url":"https://github.com/codyrobbins","followers_url":"https://api.github.com/users/codyrobbins/followers","following_url":"https://api.github.com/users/codyrobbins/following{/other_user}","gists_url":"https://api.github.com/users/codyrobbins/gists{/gist_id}","starred_url":"https://api.github.com/users/codyrobbins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codyrobbins/subscriptions","organizations_url":"https://api.github.com/users/codyrobbins/orgs","repos_url":"https://api.github.com/users/codyrobbins/repos","events_url":"https://api.github.com/users/codyrobbins/events{/privacy}","received_events_url":"https://api.github.com/users/codyrobbins/received_events","type":"User","site_admin":false},"created_at":"2015-04-22T19:37:40Z","updated_at":"2015-04-22T19:37:40Z","body":"Yup, I did a `bundle update` and went to Sprockets 3 that’s when things went awry. Thanks for the quick response!"}}