2013-05-10 45 views
1

我有一個Rails 3.2,Ruby 1.9應用程序,我試圖用bandit gem進行設置。未初始化的常量Bandit :: Engine

我已經捆綁安裝了寶石,運行bandit:install並修改了bandit.ymlround_robinmemory(發展)的值。

然而,所有試圖啓動開發服務器(rails s)導致以下錯誤:

 
/Users/michaelbuckbee/Sites/bshapp/config/routes.rb:148:in `block in ': uninitialized constant Bandit::Engine (NameError) 
    from /Users/michaelbuckbee/.rvm/gems/[email protected]/gems/actionpack-3.2.12/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec' 
    from /Users/michaelbuckbee/.rvm/gems/[email protected]/gems/actionpack-3.2.12/lib/action_dispatch/routing/route_set.rb:282:in `eval_block' 
    from /Users/michaelbuckbee/.rvm/gems/[email protected]/gems/actionpack-3.2.12/lib/action_dispatch/routing/route_set.rb:260:in `draw' 
    from /Users/michaelbuckbee/Sites/bshapp/config/routes.rb:1:in `' 

如果我從routes.rb刪除Bandit::Engine線和進入軌道控制檯我可以成功地創建老虎機實驗。

+0

你能張貼routes.rb中產生錯誤的版本? – rossta 2013-05-10 12:01:25

回答

1

我只是按照強盜自述的指示,並得到了同樣的錯誤。目前最新的標籤版本爲bandit-0.1.0;如果你沒有用gem 'bandit'指定任何選項,這是bundler將安裝的內容。我懷疑你使用的是相同的版本。查看該版本的來源,Bandit::Engine不存在。它似乎被包含在bandit HEAD中,此時在提交4c552c1efa。從HEAD捆綁解決了我的問題。

所以,加在你的Gemfile以下,捆綁安裝,並重新您的服務器:

gem 'bandit', :git => "git://github.com/bmuller/bandit.git" 
相關問題