How to reverse a 'rails generate'

前端 未结 17 1457
一个人的身影
一个人的身影 2020-12-02 03:10

I want to delete all the files it created and roll back any changes made, but not necessarily to the database, but more to the config files.

I\'d like to automatical

17条回答
  •  抹茶落季
    2020-12-02 04:08

    Before reverting the rails generate, please make sure you rollback the migration first.

    Case 1: if you want to revert scaffold then run this command:

    rails destroy scaffold MODEL_NAME
    

    Case 2: if you want to revert model then run this command:

    rails destroy model MODEL_NAME
    

    Case 3: if you want to revert controller then run this command:

    rails destroy controller CONTROLLER_NAME
    

    Note: you can also use shortcut d instead of destroy.

提交回复
热议问题