rails aborted!
NameError: uninitialized constant Viewa
/home/pedro/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.7/lib/active_support/inflector/methods.rb:268:in `const_get'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.7/lib/active_support/inflector/methods.rb:268:in `block in constantize'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.7/lib/active_support/inflector/methods.rb:266:in `each'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.7/lib/active_support/inflector/methods.rb:266:in `inject'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.7/lib/active_support/inflector/methods.rb:266:in `constantize'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/devise-4.5.0/lib/devise.rb:316:in `get'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/devise-4.5.0/lib/devise/mapping.rb:83:in `to'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/devise-4.5.0/lib/devise/mapping.rb:78:in `modules'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/devise-4.5.0/lib/devise/mapping.rb:95:in `routes'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/devise-4.5.0/lib/devise/mapping.rb:162:in `default_used_route'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/devise-4.5.0/lib/devise/mapping.rb:72:in `initialize'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/devise-4.5.0/lib/devise.rb:346:in `new'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/devise-4.5.0/lib/devise.rb:346:in `add_mapping'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/devise-4.5.0/lib/devise/rails/routes.rb:243:in `block in devise_for'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/devise-4.5.0/lib/devise/rails/routes.rb:242:in `each'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/devise-4.5.0/lib/devise/rails/routes.rb:242:in `devise_for'
/home/pedro/Desktop/Ruby_projects/twitter/config/routes.rb:2:in `block in <top (required)>'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.7/lib/action_dispatch/routing/route_set.rb:391:in `instance_exec'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.7/lib/action_dispatch/routing/route_set.rb:391:in `eval_block'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.7/lib/action_dispatch/routing/route_set.rb:373:in `draw'
/home/pedro/Desktop/Ruby_projects/twitter/config/routes.rb:1:in `<top (required)>'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/application/routes_reloader.rb:40:in `each'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/application/routes_reloader.rb:40:in `load_paths'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/application/routes_reloader.rb:16:in `reload!'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/application/routes_reloader.rb:26:in `block in updater'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.7/lib/active_support/file_update_checker.rb:77:in `execute'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/application/routes_reloader.rb:27:in `updater'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/application/finisher.rb:119:in `block in <module:Finisher>'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/initializable.rb:30:in `instance_exec'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/initializable.rb:30:in `run'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/initializable.rb:54:in `run_initializers'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/application.rb:352:in `initialize!'
/home/pedro/Desktop/Ruby_projects/twitter/config/environment.rb:5:in `<top (required)>'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/application.rb:328:in `require_environment!'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/application.rb:448:in `block in run_tasks_blocks'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/commands/rake_proxy.rb:14:in `block in run_rake_task'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/commands/rake_proxy.rb:11:in `run_rake_task'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/railties-5.0.7/lib/rails/commands.rb:18:in `<top (required)>'
/home/pedro/Desktop/Ruby_projects/twitter/bin/rails:9:in `require'
/home/pedro/Desktop/Ruby_projects/twitter/bin/rails:9:in `<top (required)>'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/home/pedro/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/home/pedro/Desktop/Ruby_projects/twitter/bin/spring:15:in `require'
/home/pedro/Desktop/Ruby_projects/twitter/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
我不小心创建了一个名为“ viewa”的设计模型,并尝试使用“ rails destroy model viewa”命令将其删除,但现在我无法进行迁移,请帮忙
答案 0 :(得分:2)
塔瑞克说了什么。
如果您正在使用Git,另一种选择是简单地运行git reset --hard
来清除工作树。 不过,如果您不关心所做的更改,请仅使用此功能。
答案 1 :(得分:1)
在您的config/routes.rb
(其中有device_for
的任何引用)中,将其删除。这应该可以解决该错误。
运行devise生成器时,它将在您的config/routes.rb
文件中生成一些代码,如下所示:
https://github.com/plataformatec/devise/blob/master/lib/generators/devise/devise_generator.rb#L21
答案 2 :(得分:0)
您尝试使用 devise 生成器删除模型吗?
$rails destroy devise Viewa