2015-11-19 65 views
1

MySQL的似乎是工作 - 我可以耙分貝:創建給NoMethodError:未定義的方法`初始化」爲Rails:模塊

$ mysql -uroot 
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 8 
Server version: 5.6.27 MySQL Community Server (GPL) 
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 
mysql> 

但是在Rails項目中,我們已經使用了好一會兒:

$ rake db:create 
14:47:41 mdurrant EQ-267 /Users/mdurrant/eq/lynx master 
$ rake db:migrate 
rake aborted! 
NoMethodError: undefined method `init' for Rails:Module 
/Users/mdurrant/eq/lynx/config/initializers/configatron.rb:2:in `<top (required)>' 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/gems/railties-3.2.22/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks' 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval' 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>' 
... 
$ ruby -v 
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0] 
14:50:33 mdurrant EQ-267 /Users/mdurrant/eq/lynx master 
$ 

$ cat config/initializers/configatron.rb 
require 'configatron' 
Configatron::Rails.init 
+1

'configatron.rb'中的代碼是什麼? –

+0

在問題 –

+0

中添加了這個信息你確定'Configtron :: Rails'中的_module_級別定義了'init'方法嗎? – linkyndy

回答

0

嘗試暫時刪除configatron.rb文件,看看是否有幫助。錯誤在第2行,所以這是問題所在。

很難確定沒有看到文件,但我想嘗試這個永久修復:

  1. 添加require 'configatron'到app.rb
  2. 更改的行所以說Configatron::Integrations::Rails.init而不是Configatron::Rails.init
相關問題