如何反转“轨道生成" [英] How to reverse a 'rails generate'

查看:40
本文介绍了如何反转“轨道生成"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除它创建的所有文件并回滚所做的任何更改,但不一定要回滚到数据库,而是回滚到配置文件.

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.

我想自动删除在 routes.rb 文件中删除的模型/控制器的所有资源映射以及其他可能进行更改的地方吗?

I'd like to automatically delete all the resource mappings for the model/controller deleted in the routes.rb file and everywhere else that changes might have been made?

推荐答案

rails destroy controller lalala
rails destroy model yadayada
rails destroy scaffold hohoho

Rails 3.2 为命令添加了一个新的 d 快捷方式,因此现在您可以编写:

Rails 3.2 adds a new d shortcut to the command, so now you can write:

rails d controller lalala
rails d model yadayada
rails d scaffold hohoho

这篇关于如何反转“轨道生成"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆