gpt4 book ai didi

ruby-on-rails - 我在 rails generate devise :install 之前运行了 rails generate devise MODEL

转载 作者:数据小太阳 更新时间:2023-10-29 06:55:41 25 4
gpt4 key购买 nike

我在运行初始 Devise 生成器之前不小心添加了我的 Devise 模型。

我先运行的代码:

$ rails generate devise MODEL

初始设计生成器(我应该先运行的):

$ rails generate devise:install

我现在有一个名为 Model 的设计 Controller ,它不允许我运行“rake db:migrate”

错误:

rake aborted!
User does not respond to 'devise' method. This usually means you haven't loaded your ORM file or it's being loaded too late. To fix it, be sure to require 'devise/orm/YOUR_ORM' inside 'config/initializers/devise.rb' or before your application definition in 'config/application.rb'
/Users/andyHuynh/.rvm/gems/ruby-1.9.3-p327/gems/devise-2.2.3/lib/devise/rails/routes.rb:443:in `raise_no_devise_method_error!'
/Users/andyHuynh/.rvm/gems/ruby-1.9.3-p327/gems/devise-2.2.3/lib/devise/rails/routes.rb:211:in `block in devise_for'
/Users/andyHuynh/.rvm/gems/ruby-1.9.3-p327/gems/devise-2.2.3/lib/devise/rails/routes.rb:207:in `each'
/Users/andyHuynh/.rvm/gems/ruby-1.9.3-p327/gems/devise-2.2.3/lib/devise/rails/routes.rb:207:in `devise_for'
/Users/andyHuynh/Code/jargon/config/routes.rb:3:in `block in <top (required)>'
/Users/andyHuynh/.rvm/gems/ruby-1.9.3-p327@global/gems/actionpack-3.2.12/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec'
/Users/andyHuynh/.rvm/gems/ruby-1.9.3-p327@global/gems/actionpack-3.2.12/lib/action_dispatch/routing/route_set.rb:282:in `eval_block'
/Users/andyHuynh/.rvm/gems/ruby-1.9.3-p327@global/gems/actionpack-3.2.12/lib/action_dispatch/routing/route_set.rb:260:in `draw'
/Users/andyHuynh/Code/jargon/config/routes.rb:1:in `<top (required)>'
...

有没有一种方法可以撤消此过程以先运行初始生成器?我正在使用 Rails 3.2.12。任何帮助表示赞赏。谢谢

最佳答案

您可以使用 rails destroy ... 撤消生成命令,因此在您的情况下它将是:

$ rails destroy devise MODEL

如果出于某种原因这不起作用,您可以删除模型和迁移 - 它们只是文件。

关于ruby-on-rails - 我在 rails generate devise :install 之前运行了 rails generate devise MODEL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15918563/

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