|
| 1 | +Twitter @crnixon |
| 2 | + |
| 3 | +Migrating Legacy Rails Apps to Rails 3 |
| 4 | + |
| 5 | +bit.ly/rails3up |
| 6 | +http://pinboard.in/u:crnixon/t:rails3upgrade/ |
| 7 | + |
| 8 | +Upgrade path from rails 2.3.x to rails3: |
| 9 | + * upgrade to latest rails 2.3.x |
| 10 | + rake rails:update |
| 11 | + * fix deprecation warnings |
| 12 | + * install rails_xss plugin and fix views. |
| 13 | + * rename .rhtml, .rxml, .rjs files |
| 14 | + * install Bundler |
| 15 | + gem install xxx |
| 16 | + rake rails:update:gems |
| 17 | + * replace plugins with gems |
| 18 | + put customized plugins into Gitbub and pull into Gemfile |
| 19 | + * install rails_upgrade plugin |
| 20 | + rake rails:upgrade:check # save output to a file |
| 21 | + rake rails:upgrade:backup # gives a list of backed-up files |
| 22 | + rake rails:upgrade:gems # doesn't check config/environments/*.rb for config.gem stuff |
| 23 | + rake rails:upgrade:routes # not perfect, but mostly works in rails3 |
| 24 | + rake rails:upgrade:configuration # creates config/application.rb file |
| 25 | + * remove preinitializer.rb if you were using Bundler before |
| 26 | + * lib directory not autoloaded by default: |
| 27 | + config.load_path += %W(#{config.root}/lib) |
| 28 | + * ujs |
| 29 | + add csrf_meta_tag inside <head> |
| 30 | + install jquery-rails gem and install its rails.js to public/javascripts and include in app layout |
| 31 | + |
| 32 | + |
| 33 | +XSS: |
| 34 | + * =h not used anymore; =raw is opposite of =h |
| 35 | + * call :html_safe method on a String to 'make it safe' |
| 36 | + * YAML locale stirings are escaped unless the key name ends in '_html' |
| 37 | + * |
| 38 | + |
| 39 | +How to install bundler gems in production: |
| 40 | + bundle install --deployment |
| 41 | + |
| 42 | +git tips: |
| 43 | + * git add --patch |
| 44 | + * git add --edit |
| 45 | +Alternative to rvm and gemsets... install gems locally: |
| 46 | + bundle install --path vendor |
| 47 | + bundle package |
| 48 | + check your Gemfile.lock into version control |
| 49 | + |
| 50 | + |
| 51 | +Dependencies, etc: |
| 52 | + * rspec: |
| 53 | + * New rspec syntax |
| 54 | + require 'rspec' |
| 55 | + require 'rspec/rails' |
| 56 | + * other rspec stuff |
| 57 | + make sure rspec-rails in in the development and test groups in Gemfile |
| 58 | + Cucumber uses the test environment now |
| 59 | + * might need to install rpec2-rails-views-matchers gem |
| 60 | + * factory_girl gem is renamed to factory_girl_rails gem for rails3 |
| 61 | + * rails3 branch of will_paginate is in beta |
| 62 | + kaminari gem is stable and a good replacement for will_paginate |
| 63 | + * |
| 64 | + |
| 65 | +Ruby 1.9 stuff: |
| 66 | + * new syntax for case statements (breaks old stuff) |
| 67 | + * new optional syntax for Hash |
| 68 | + |
0 commit comments