ruby-on-rails – 如何为Rails中的Devise设置密钥?

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 如何为Rails中的Devise设置密钥?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
添加了Devise gem然后按照说明运行rails generate devise:install,结果如下:
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/devise-3.2.4/lib/devise/rails/routes.rb:487:in        `raise_no_secret_key': Devise.secret_key was not set. Please add the following to your Devise initializer: (RuntimeError)

config.secret_key = 'abc123'

Please ensure you restarted your application after installing Devise or setting the key.

如何“重启”我的申请?我如何以及在何处设置密钥?

解决方法

为了生成秘密运行:
bundle exec rake secret

并将结果从控制台复制到设计初始化程序(config / initializers / devise.rb)

config.secret_key = '4fce3c1c860216b8......'

猜你在找的Ruby相关文章