Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 从RubyonRails应用程序中删除不存在的模型_Ruby On Rails_Ruby_Ruby On Rails 5 - Fatal编程技术网

Ruby on rails 从RubyonRails应用程序中删除不存在的模型

Ruby on rails 从RubyonRails应用程序中删除不存在的模型,ruby-on-rails,ruby,ruby-on-rails-5,Ruby On Rails,Ruby,Ruby On Rails 5,我将从我的应用程序中删除现有的模型,然后它就可以正常工作了 rails d模型学生 给出: invoke active_record remove db/migrate/20170803044626_create_students.rb remove app/models/student.rb invoke test_unit remove test/models/student_test.rb remove test/fixtures/stu

我将从我的应用程序中删除现有的模型,然后它就可以正常工作了

rails d模型学生

给出:

 invoke  active_record
 remove    db/migrate/20170803044626_create_students.rb
 remove    app/models/student.rb
 invoke    test_unit
 remove      test/models/student_test.rb
 remove      test/fixtures/students.yml
     invoke  active_record
     remove    db/migrate/20170803044857_create_tests.rb
     remove    app/models/test.rb
     invoke    test_unit
     remove      test/models/test_test.rb
     remove      test/fixtures/tests.yml
当我要删除不存在的模型时,比如

rails d模型测试

给出:

 invoke  active_record
 remove    db/migrate/20170803044626_create_students.rb
 remove    app/models/student.rb
 invoke    test_unit
 remove      test/models/student_test.rb
 remove      test/fixtures/students.yml
     invoke  active_record
     remove    db/migrate/20170803044857_create_tests.rb
     remove    app/models/test.rb
     invoke    test_unit
     remove      test/models/test_test.rb
     remove      test/fixtures/tests.yml
为什么要删除模型?虽然模型不存在,但我预计会出现错误


您必须查看此实现的rails源代码。我不认为这是一个问题。这就是它的实现方式。如果您一次又一次地运行相同的命令,那么即使它也不会抱怨@AmitPatel那么从何而来
remove db/migrate/20170803044857_create_tests.rb remove app/models/test.rb invoke test_unit remove test/models/test.rb remove test/fixtures/tests.yml
它试图删除这些文件,但实际上什么都没有发生,因为它们不存在。您只是看到了试图找到它们时的控制台输出。问题是Rails试图按照用户的要求去做,还是用户的要求是不可能的?