繁体   English   中英

未初始化的常量RAILS_ROOT:Surveyor gem和使用Rails.root

[英]Uninitialized constant RAILS_ROOT: Surveyor gem and using Rails.root

我正在尝试使用提供的安装指南来设置Surveyor gem 我正在从这里可用的测量师示例工作,因此我假设我将在较旧的代码中工作。 但是,当我跑步时

bundle exec rake surveyor FILE=surveys/kitchen_sink_survey.rb

出现错误“未初始化的常量RAILS_ROOT”。 在这里读到解决方案是尝试使用Rails.root ,但是我不确定在哪里更改此设置。 这是我在environment.rb或调查代码本身中设置的吗?

如果它提供任何进一步的帮助,则是跟踪的结果:

/home/nitrous/surveyor_example/.bundle/bundler/gems/surveyor-a95169e36afc/lib/tasks/surveyor_tasks.rake:7:in `block (2 levels) in <top (required)>'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/opt/rbenv/versions/2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/task.rb:174:in `each'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/local/opt/rbenv/versions/2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/home/nitrous/surveyor_example/.bundle/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/home/nitrous/surveyor_example/.bundle/bin/rake:23:in `load'
/home/nitrous/surveyor_example/.bundle/bin/rake:23:in `<main>'

该错误来自您所使用的Surveyor gem的版本。 surveyor-a95169e36afc是指较旧的版本。

在您的Gemfile中,确保您只有

gem 'surveyor'

bundle install

一旦设置好,它应该安装surveyor 0.20.0 ,它将与您的Rails版本一起使用。

本教程中包含的Gemfile已过期/用于其他版本的rails。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM