Rails 3 正在移除 Metal 吗?
Rails 3 正在移除 Metal 吗?
我正在尝试实现 Mongoid、Carrierwave 和 grid_fs。
我已遵循指南 1。
但是,我读到 Rails 3 正在删除 Metal ( http://github.com/rails/rails /commit/ed34652d1aca148fea61c5309c1bd5ff3a55abfa )。
所以我偶然发现了这篇文章: 指南 2
考虑到 Rails 3 可能会删除 Metal 并用于将来的维护。哪个指南更适合让 grid_fs、Mongoid 和 Carrierwave 一起工作?
Is Rails 3 removing Metal?
I am trying to implement Mongoid, Carrierwave and grid_fs.
I have followed guide 1.
However, I have read that Rails 3 is removing Metal ( http://github.com/rails/rails/commit/ed34652d1aca148fea61c5309c1bd5ff3a55abfa ).
So I stumbled across this article instead: guide 2
Given the circumstances that Rails 3 may be removing Metal and for future maintenance. Which guide is more suitable to get grid_fs, Mongoid and Carrierwave all working together?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您注意到带有注释“Removing Metal from Rails 3”的提交。然而,所发生的事情实际上与这句话完全相反!
Rails 3 没有移除金属。恰恰相反。现在,所有控制器都是金属,仅具有您要求的附加功能。您需要做的就是从
ActionController::Metal
继承您的特定控制器类,然后包含
提供您想要在该特定控制器中提供的附加功能的任何特定模块。当然,大多数人都会从
ActionController::Base
继承他们的控制器。但现在,ActionController::Base
仅继承ActionController::Metal
并包含所有附加功能模块。您注意到的那个提交正在将金属作为一个单独功能删除,与
ActionPack
的其余部分分开。现在,金属不再是一个单独功能,因此金属的单独功能实现被删除。现在,一切都是金属。You noticed a commit with the comment "Removing Metal from Rails 3." However, what is going on is actually quite the opposite of that phrase!
Rails 3 did not remove metal. Quite the opposite. Now, all controllers are metals, with only those additional features that you request. All you need to do is inherit your particular controller class from
ActionController::Metal
, and theninclude
any particular modules that provide the additional features you want in that particular controller.Of course, most people will inherit their controllers from
ActionController::Base
. But now,ActionController::Base
merely inheritsActionController::Metal
and includes all of the additional feature modules.That commit you noticed is removing metals as a separate feature, apart from the rest of
ActionPack
. Now, metals are no longer a separate feature, so the separate feature implementation of metals was removed. Now, everything is a metal.