gpt4 book ai didi

mysql - rake 数据库 :create gives NoMethodError: undefined method `init' for Rails:Module

转载 作者:行者123 更新时间:2023-11-30 22:31:22 24 4
gpt4 key购买 nike

mysql 似乎可以工作 - 我可以

$ 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 项目中,我们已经使用了一段时间的 ok:

$ 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

最佳答案

尝试暂时删除 configatron.rb 文件,看看是否有帮助。错误在第 2 行,所以这就是问题所在。

如果没有看到文件很难确定,但我会尝试永久修复它:

  1. require 'configatron' 添加到 app.rb
  2. 更改行,使其显示 Configatron::Integrations::Rails.init 而不是 Configatron::Rails.init

关于mysql - rake 数据库 :create gives NoMethodError: undefined method `init' for Rails:Module,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33813314/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com