加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Rails配置密钥库返回nil

发布时间:2020-12-16 21:31:09 所属栏目:百科 来源:网络整理
导读:运行rails控制台时,我在开发环境中对Rails.configuration.secret_key_base的调用一直没有返回. #secrets.ymldevelopment: secret_key_base: the-long-secret-generated-by-rake-secret#...other configs,a call while running heroku rails c in production
运行rails控制台时,我在开发环境中对Rails.configuration.secret_key_base的调用一直没有返回.
#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

怎么会这样?运行导轨4.1.0

解决方法

如 the documentation所述:

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

从控制台运行Rails.application.secrets.secret_key_base应该返回:-l-secret-secret-by-rake-secret

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读