在我的config/initializers/figaro.rb
我说:
Figaro.require_keys("MANDRILL_API_KEY")
但在运行rails s
时得到以下内容:
Exiting
/Users/guycao/code/oms_on_rails/config/initializers/figaro.rb:1:in `<top (required)>': undefined method `require_keys' for Figaro:Module (NoMethodError)
from /Users/guycao/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.2/lib/active_support/dependencies.rb:241:in `load'
from /Users/guycao/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.2/lib/active_support/dependencies.rb:241:in `block in load'
from /Users/guycao/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.2/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/guycao/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.2/lib/active_support/dependencies.rb:241:in `load'
...
以下是我的配置:
费加罗版 - 0.7.0
Ruby版本 - ruby 2.1.2p95(2014-05-08修订版45877)[x86_64-darwin13.0]
Rails版本 - 4.1.2
为了您的信息,application.yml
中存在环境变量
但即使它不存在,也不应抱怨无法找到require_keys
方法。
我错过了什么吗?我试过了require "figaro"
答案 0 :(得分:1)
Figaro.require_keys
。它之前被称为Figaro.require
。将figaro升级到1.x或使用require
方法。
https://github.com/laserlemon/figaro/blame/master/CHANGELOG.md#L6