为什么 Ruby on Rails 专业人员不使用 Scaffolding? [英] Why do Ruby on Rails professionals NOT use Scaffolding?

查看:43
本文介绍了为什么 Ruby on Rails 专业人员不使用 Scaffolding?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有时会从那些似乎用更长时间的人那里读到,他们学到的一个重要教训是不要使用脚手架".同样在 irc 上,我通常会从这个方向阅读提示.我的问题是为什么,它有什么不好的地方?nifty_scaffolding 也很糟糕吗?

I read sometimes from people that seem to be working with rails since longer, that one important lesson they learnt would be "Don't use scaffolding". Also on irc I read commonly hints from this direction. My question is why, what is the bad thing about it? And is nifty_scaffolding bad as well?

我的猜测是它很糟糕,因为它默认生成一个 xml 版本的控制器操作,这会将我们应用程序的字段名称暴露给任何人并使其更容易受到攻击,所以也许就是这样?

My guess would be it is bad because it generates by default an xml version of your controller action, which would expose the field names of our application to anybody and make it more vulnerable for attacks, so maybe it's this?

你不做脚手架的原因是什么?

What are your reasons to not do scaffolding?

推荐答案

我对 Rails 很有经验,我很少使用脚手架,因为我的最终目标远不是简单的 CRUD 操作.但是,没有严格的规定不使用脚手架.一些程序员对此不以为然,因为它实际上是脚手架,字面意思.它不是成品.脚手架在您构建实际产品时为您提供支持.在谷歌图片中搜索脚手架",您就会明白这一点.

I'm experienced with rails and I rarely use scaffolding simply because my end goal is far from simple CRUD actions. However, there's no strict rule to not use scaffolding. Some coders frown on it because it is actually scaffolding, literally. It's not a finished product. Scaffolding supports you as you build the actual product. Search google images for "scaffolding" and you should get the idea.

记住 scaffold 只是许多内置的 Rails 中的生成器.Rails 生成器只是一个输出一些通用代码的脚本.生成器是非常有用的节省时间的工具,您很快就会发现自己编写生成器为您自己的定制需要.

Keep in mind scaffold is just one of many built-in generators in Rails. A Rails generator is simply a script that outputs some generic code. Generators are very useful time-savers, and you'll quickly find yourself writing generators for your own custom needs.

这篇关于为什么 Ruby on Rails 专业人员不使用 Scaffolding?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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