7

When running rails console, my call to Rails.configuration.secret_key_base in my development environment keeps returning nil.

#secrets.yml

development:
  secret_key_base: the-long-secret-generated-by-rake-secret

#...other configs, a call while running heroku rails c in production also returns nil

How can this be? Running rails 4.1.0

1 Answer 1

18

As noted in the documentation:

The secrets added to this file are accessible via Rails.application.secrets.

Running Rails.application.secrets.secret_key_base from the console should return: the-long-secret-generated-by-rake-secret

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, errant on my part. I had read in another (not official) rails guide to call it this way. edgeguides.rubyonrails.org/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.