Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating rails model for dropped migration

I had a model customer, which I have generated using the following

rails g model Customer name:string

After some time, I decided to rename the model to customer_type, to accomplish this we wrote an another migration

rails g migration RenameCutomerToCustomerType

everything was smooth until I had the requirement to add the model named customer. When I issued the following command, I've started getting "Another migration is already named create_customer"

rails g model Customer

I think this kind of scenario is very common in CRUD based project, please suggest on how to over come this? Is this a limitation with rails?

like image 398
Krishnaswamy Subramanian Avatar asked Jul 26 '11 08:07

Krishnaswamy Subramanian


2 Answers

Just rename old migration filename and classname. Both don't affect anything.

btw: This scenario is quite rare so I don't think that there is any need in specific actions from framework

like image 135
iafonov Avatar answered Sep 19 '22 23:09

iafonov


rails destroy model MODELNAME, will remove the model.

like image 37
dmp Avatar answered Sep 16 '22 23:09

dmp