簡體   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