computer_smile
computer_smile

Reputation: 2227

Rails configuration secret key base returning nil

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

Upvotes: 7

Views: 5245

Answers (1)

Lukas Eklund
Lukas Eklund

Reputation: 6138

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

Upvotes: 18

Related Questions