Rails 3 已弃用的方法和 API
在哪里可以找到已弃用的方法、API 等的列表,以便从 Rails 2.x 升级到 Rails 3?
Where can one find a list of deprecated methods, APIs, etc, in order to upgrade from Rails 2.x to Rails 3?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
Rails 3 发行说明 有很多有用的信息:
Railties 现已弃用:
ActionController:
通过 Rails.application.config.cookie_secret 并移至其自己的文件中:
配置/初始化程序/cookie_verification_secret.rb。
config.filter_parameters << :密码。
Active Record 类中的ActiveRecordnamed_scope
ActionMailer
The Rails 3 release notes have lots of good information:
Railties now deprecates:
ActionController:
through Rails.application.config.cookie_secret and moved into its own file:
config/initializers/cookie_verification_secret.rb.
config.filter_parameters << :password.
ActiveRecord
ActionMailer
我认为您不会找到详尽的折旧列表,因为这实际上取决于您要升级的 Rails 版本。例如,Rails 2.3.9(刚刚发布)比之前的版本增加了额外的折旧。
Rails 升级手册(如上所述)是一个很棒的工具,包含 12 页的折旧警告以及如何修复他们。我认为它们不会在这里发布,因为你只需花 9 美元下载 pdf 即可获得列表。附带的教程和其他信息使其非常值得。这是给我的。
如果您不想为优质信息付费,只需针对您的特定应用程序运行rails_upgrade 插件即可。有关该插件如何使用的更多信息,请访问 rails 升级插件 github 页面。
I don't think you'll find an exhaustive list of depreciations because it really depends on what version of rails you are upgrading from. For instance, Rails 2.3.9 (just released) added additional depreciations over the previous release.
The Rails Upgrade Handbook (as mentioned above) is a great tool and contains 12 pages of depreciation warnings and how to fix them. I don't think they'll be published here because you should just drop the $9 and download the pdf to get the list. The included tutorials and other information makes it well worth it. It was for me.
If you don't want to pay for good information then just run the rails_upgrade plugin for your specific application. More information on how the plugin is on the rails upgrade plugin github page.
检查单个应用程序细节的一个好方法是在其上运行 rails_upgrade 插件(您可以在 GitHub 上找到它),它将输出弃用通知和建议的列表
一些有用的信息是这篇博文也总结了: http:// www.simonecarletti.com/blog/2010/07/the-way-to-rails-3/
另外,Railscasts 有很多关于 API 各个变化方面的电影。访问 Railscasts.com 并浏览 rails3 标签下归档的电影。
A good way of checking the specifics about an individual app would be to run the rails_upgrade plugin on it (you can find it at GitHub), it will output a list of deprecation notices and recommendations
Some useful info is also summarised in this blog post: http://www.simonecarletti.com/blog/2010/07/the-way-to-rails-3/
Additionally Railscasts has a bunch of movies on various changed aspects of the API. Go to Railscasts.com and browse the movies filed under the rails3 tag.
我发现购买 http://www.railsupgradehandbook.com/ 非常划算
I found it to be a great value to buy http://www.railsupgradehandbook.com/
另一个弃用活动记录的地方是这里(http://m.onkey.org/active-record-query-interface)。
如果觉得有用就回复。
Another place to have deprecation's for active record is here (http://m.onkey.org/active-record-query-interface).
Reply if found useful.
如何在没有 Rails 的情况下禁用 ActiveRecord 中的着色日志记录? AR 现在不再是保持解耦、独立的 ORM,而是与 Rails 框架紧密绑定。
将 ActiveRecord::Base.colorize_logging 移动到 Rails::LogSubscriber.colorize_logging 只是糟糕的设计和错误的方向,不是吗?
How to disable colorize logging in ActiveRecord without Rails? Instead of keeping AR decoupled, independent ORM, it is now tightly bound to Rails framework.
Moving ActiveRecord::Base.colorize_logging to Rails::LogSubscriber.colorize_logging was just bad design and the wrong direction, wasn't was?