Successfully reported this slideshow.

Upgrading to rails3

2,125 views

Published on

  • Be the first to comment

Upgrading to rails3

  1. 1. Upgrading to Rails 3
  2. 2. About Me • a.k.a “xdite” • http://blog.xdite.net • http://plurk.com/xdite • http://github.com/xdite • Ruby on Rails Developer since 2007 • Rails Developer of HTC
  3. 3. Rails 3
  4. 4. http://weblog.rubyonrails.org/2008/12/23/merb-gets-merged-into-rails-3
  5. 5. It’s a big bang rewrite ...
  6. 6. What will change?
  7. 7. see ihower’s slide!
  8. 8. Basis • ActiveRecord Query API • ActiveRecord Validation API • View: XSS • View: Javascript • Routing • Bundler
  9. 9. Upgrade is dangerous
  10. 10. But !
  11. 11. rails3 [*****] XDXD 6/09 3:33:08 ihower
  12. 12. Cost: 3h4m
  13. 13. Prerequisites • Test Coverage • Rails 1.8.7 and Rails 3 • RackEnv ( using Passenger ) • git remote branch • Strong Heart and Excellent Ruby Skill.
  14. 14. What will you face? (major) • Query API change. • HTML auto Escape • Routing Changes • Unobtrusive Javascript • Plugin Broken ( internal API Channges )
  15. 15. What can you do? ( major) • use Rails Best Practice. • writing tests • move config.gem to Gemfile • move rjs to unobtrusive javascripts. • organize the same logic in HTML to helpers. • replacing plugin to gem. • survey plugin for rails3 ( railsplugins.org)
  16. 16. Rails Best Practices • Move code from Controller to Model • Extract into Module • Never logic code in Views • Organize Helper files
  17. 17. STEP • install rails3 • modified httpd for RackEnv • git branch rails3 • run rails-upgrade check, and document it. • backup files ( route.rb, application.rb ... ) • rails new . • run test, and fix. till finish......
  18. 18. Normally, you will fail...
  19. 19. Because... • Not writing test (!!!) • Writing model logic in views.(!!!) • Post.find(:all).map{ |c| [c.name, c.id] } • Copy & Paste anywhere(!!!) • broken everywhere based on the same thing • Fixing bug and refactoring project in the same time.(!!!!!!!!!!!!!)
  20. 20. prepare well before starting
  21. 21. Resources • The Rails 3 Upgrade Handbook • Bundler • RailsPlugins.org • The Lowdown on Routes in Rails. • Unobtrusive Javascript in Rails 3
  22. 22. We are hiring!! xdite_cheng@htc.com

×