I accidentally added my Devise model before running the initial Devise generator.
Code I ran first:
$ rails generate devise MODEL
Initial Devise generator (what I should have ran first):
$ rails generate devise:install
I now have a devise controller called Model that won't let me run 'rake db:migrate'
Error:
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)>'
...
Is there a way I can undo this process to run the initial generator first? I am using Rails 3.2.12. Any help is appreciated. Thanks
You can undo generation commands with rails destroy ...
, so in your case it would be:
$ rails destroy devise MODEL
If that doesn't work for whatever reason, you can just delete the model and migration - they're only files.
rails destroy model devise:user or rails destroy scaffold devise:user
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With