开发者

What to Learn: Rails 1.2.4 -> Rails 3

I've recently con开发者_如何转开发vinced my management that our outdated version of Rails (1.2.4) is slowing us down enough to warrant an upgrade. The approach we're taking is to start a fresh project with current technology rather than a painful upgrade. Our requirements for the project have changed and this will be much easier.

The biggest problem is actually that my knowledge of Rails is out of date. I've dealt only with Rails 1.2.4 at work while the rest of the world has moved on long ago. What topics have I missed by being buried in my work instead of keeping up with the current Rails fashion?

I'm hesitant to dig through blogs at random because I'm not sure how much has changed between the intervening versions of Rails. It's no use to learn Rails 2.1-2.3 specific stuff that is no longer useful for Rails 3.


Most noticeable changes for application developers:

  • New ActiveRecord Query API
  • The Lowdown on Routes in Rails 3
  • Bundler for managing gem dependancies
  • Action Mailer in Rails 3
  • Unobtrusive Javascript
  • XSS Protection in Rails 3
  • Rails 3 tutorials from Rails Dispatch

Other conventions and APIs to be aware of if you're coming from Rails 1.X which were introduced in Rails 2.X and exist in Rails 3.

  • RESTful controllers
  • Scope (Formally named scope)
  • Query caching
  • Nested attributes

Can't emphasise enough how RESTful controllers and scopes will enable you to write cleaner rails applications with more reusability. Tonne of information floating around on these topics.

Further reading about the development of Rails 3:

  • http://www.engineyard.com/blog/2009/rails-and-merb-merge-the-anniversary-part-1-of-6/
  • http://www.engineyard.com/blog/2009/rails-and-merb-merge-performance-part-2-of-6/
  • http://www.engineyard.com/blog/2010/rails-and-merb-merge-plugin-api-part-3-of-6/
  • http://www.engineyard.com/blog/2010/rails-and-merb-merge-rails-core-part-4-of-6/
  • http://www.engineyard.com/blog/2010/rails-and-merb-merge-orm-agnosticism-part-5-of-6/
  • http://www.engineyard.com/blog/2010/rails-and-merb-merge-rack-part-6-of-6/


I would take a look at Peepcodes live upgrade video. In it they upgrade a Rails 2 app to Rails 3. That should give you some inkling of what you are in for (even though your upgrade would look pretty different) so you can make a somewhat informed decision.


It's also worth checking out the excellent Railscasts by Ryan Bates at http://railscasts.com/

He covers a lot of new features in Rails as they come out (with recent screencasts focusing on Rails 3), so they're a nice way to get up to speed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜