Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails : Error trying to generate a model : Name already in use

I am new to Ruby on Rails. I am trying to generate a model using the command

rails generate model Movie title:text year:integer rating:integer description:text

But I get the error :

 invoke  active_record The name 'Movie' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again.

I really want to keep the name Movie. I have also tried the below to delete the table - but the table does not exists in the database

sqlite> drop table Movie;
Error: no such table: Movie

I am not sure how to fix this error or what is causing it. Any help with this would be great. Thanks in advance.

like image 696
maddie Avatar asked Mar 13 '23 18:03

maddie


1 Answers

You can revert by running rails destroy model Movie. This will remove model, migration, tests, and fixtures that have been previously generated.

like image 169
sebsonic2o Avatar answered Apr 25 '23 06:04

sebsonic2o