将 Rails 2 升级到 Rails 3 是否会出现兼容性问题?
我考虑将 Rails 2 应用程序升级到 Rails 3,原因有很多(rails 3 功能、某些插件需要 Rails 3 等),
显然我也必须更新/升级一些插件。但就代码本身而言,升级到3会不会有兼容性问题呢?我知道 Rails 3 更改了很多帮助程序和语法以使事情变得更容易,但是旧的和更复杂的方法仍然有效(例如,environment.rb 中的 gem,而不是 Gemfile)。
另外,有人知道如何做的好教程吗?
Im considering upgrading a rails 2 app to rails 3 for a number of reasons (rails 3 features, certain plugins require rails 3 etc.)
Obviously ill have to update/grade some of the plugins as well. But concerning the code itself, should there be any compatibility issues when upgrading to 3? I know rails 3 changes a lot of helpers and syntax to make things easier, but do the older and more complicated ways still work (ex. gems in envioronment.rb, not Gemfile).
Also, anyone know a good tutorial on how to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我写了一篇关于它的 博客文章,其中我指出了标准资源,但也处理了一些我遇到的更深层次的问题。
希望这有帮助。
I have written a blogpost about it, where I point to the standard resources, but also handle some more deeper problems I encountered.
Hope this helps.
您可以尝试使用此插件来检查您的应用程序在 Rails 3 中的兼容性。 https://github.com/rails/rails_upgrade
You may try this plugin to check your application compatibility in Rails 3. https://github.com/rails/rails_upgrade
如果您想从 Rails 2 升级到 Rails 3,请首先确保升级到最新的 2.3 版本。
然后,在迁移之前,有一个 您需要进行的更改列表可以 make 使您的 Rails 2.3 应用程序表现得像 Rails 3 应用程序。应用这些更改后,问题的数量可能会减少,并且您可以升级到 Rails 3。
安装 Rails 3 后,请使用 rails_upgrade 插件来检查不兼容性并修复它们。
If you want to upgrade from Rails 2 to Rails 3, first make sure to upgrade to the latest 2.3 version.
Then, before migrating, there is a list of changes you can make to make your Rails 2.3 application behaving like a Rails 3 application. Once you applied these changes, chances are the number of issues will be smaller and you can upgrade to Rails 3.
Once you installed Rails 3, use the rails_upgrade plugin to check the incompatibilities and fix them.