gpt4 book ai didi

ruby-on-rails - 默认脚手架和漂亮的 :scaffold? 有什么区别

转载 作者:行者123 更新时间:2023-12-04 10:10:40 27 4
gpt4 key购买 nike

我正在尝试生成一个布局,我可以在 my rails webapp 之间使用它和移动版本。我一直在用nifty-generator ,但它说生成的文件与 rails3 新应用程序创建生成的文件相同。
default scaffold之间的主要区别是什么?和 nifty:scaffold ?

最佳答案

如果您在“疑难解答和常见问题解答”下访问该项目的 Github 页面 (https://github.com/ryanb/nifty-generators),它会回答一些问题,包括这个问题。那里给出的回应是:

One of the primary differences is that nifty:scaffold allows you to choose which controller actions to generate.

rails g nifty:scaffold post name:string index new edit

There are a few changes to the generated code as well, such as no XML format by default.

It also offers support for HAML, Shoulda, and RSpec.



一旦您掌握了 Rails 在其 RESTful Controller 中所需的代码,我强烈建议您改用继承资源 ( https://github.com/josevalim/inherited_resources )。它确实有助于干燥您的 Controller 。

关于ruby-on-rails - 默认脚手架和漂亮的 :scaffold? 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8698353/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com