简体   繁体   English

ROR:支架与否?

[英]ROR: To scaffold or not?

I love scaffolding and it extremely helpful for prototyping. 我喜欢脚手架,它对原型设计非常有帮助。 But Should we use scaffolding for developing application as such? 但是我们应该使用脚手架来开发应用程序吗?

The name "scaffolding" is sort of a misnomer in Rails now (post 2.0). “脚手架”这个名字现在在Rails中有点用词不当(2.0后)。 The structure generated through scaffolding generator is more of a base application to build on, rather than a "prototype" that you throw away later. 通过脚手架生成器生成的结构更像是构建的基础应用程序,而不是您稍后丢弃的“原型”。

At least, if you are designing your application to be RESTful, you will find yourself keeping most of the scaffold generator produced controller and model code, while adding more logic to them. 至少,如果您将应用程序设计为RESTful,您将发现自己保留大部分脚手架生成器生成的控制器和模型代码,同时为它们添加更多逻辑。 You will perhaps replace the views eventually while keeping bits and pieces of Ruby code in them. 您可能最终会替换视图,同时保留Ruby代码中的一些部分。

There is no harm in using scaffold to kick-start development of your application. 使用scaffold来启动应用程序开发没有任何害处。 However, if you are a newbie you need to understand how stuff can be done without it. 但是,如果你是一个新手,你需要了解如何在没有它的情况下完成任务。 Scaffold is a tool for rapid prototype development in rails and can be used if you can alter it to suit your requirements quickly. Scaffold是一种用于在轨道中进行快速原型开发的工具,如果您可以快速更改它以满足您的要求,则可以使用它。

i use it a lot 我经常使用它

i strt off with scaffolding and then gradually replace it with custom code; 我用脚手架然后逐步用自定义代码替换它; it's a great way to get something up and running pretty quick. 这是一个很好的方式来获得一些东西,并迅速运行。

我读了一些书,作者都告诉我,开发人员不会在商业项目中使用它。所以我不会在我的项目中随时使用它。但这只是我的选择,取决于你。

Actually It's depends on your requirements. 实际上这取决于您的要求。 When we consider about the scaffold it will generate CRUD(Create, Read, Update and Delete) operations instantly. 当我们考虑脚手架时,它将立即生成CRUD(创建,读取,更新和删除)操作。 So if you need to remove some of operations its really easy if you coded it manually. 因此,如果您需要删除一些操作,如果您手动编码它,则非常简单。 But that also can be done by using scaffold also. 但这也可以通过使用脚手架来完成。 Just you have to remove those methods only. 只是你必须删除这些方法。 So it's your choice whether you use it or not 因此无论您是否使用它都是您的选择

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM