ruby-on-rails – 我在rails生成设计之前运行了rails generate设计模型:安装

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 我在rails生成设计之前运行了rails generate设计模型:安装前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在运行初始Devise生成器之前意外添加了我的Devise模型.

我先运行的代码

$rails generate devise MODEL

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

$rails generate devise:install

我现在有一个名为Model的设计控制器,它不会让我运行’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相关文章