开发者

Generating rails model for dropped migration

开发者 https://www.devze.com 2023-03-23 10:44 出处:网络
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 a

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 mi开发者_JAVA技巧gration 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?


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


rails destroy model MODELNAME, will remove the model.

0

精彩评论

暂无评论...
验证码 换一张
取 消