Rails3.0.5のプロジェクトをRails3.0.6に対応させた
Rails3.0.5でお仕事をしていたのですが、Rails3.0.6が出てしまいました。
http://weblog.rubyonrails.org/2011/4/6/rails-3-0-6-has-been-released
Rails 3.0.6 contains an important security fix! Please upgrade!
ですと。じゃ、バージョン上げましょう。
以下の作業を実施しました。
下準備
まずは丸々バックアップ
そして、Rails3.0.6の取得
cp -R project/ project_bak/ gem update rails
プロジェクトのアップデート
rails rake:update
これでプロジェクトにアップデートが適応されます。
その結果、書き換えられるファイルが出てきます。
Overwrite /rails/project/config/routes.rb? (enter "h" for help) [Ynaqdh] h Y - yes, overwrite n - no, do not overwrite a - all, overwrite this and all others q - quit, abort d - diff, show the differences between the old and the new h - help, show this help
という感じで上書きされるところで止まり、どうするかを聞いてきます。
dでDIFFを取り、メモしておいて後で対応が良いと思います。今回はなるべく上書きを選びました。
その結果、jqueryに変更しているところが丸々元に戻されてしまいました。
最初に取っておいたバックアップからrails.jsを復活させ、不要なJavascriptのファイル(Prototype関連)を削除しました。
(注意:私はGitHub - rails/jquery-ujs: Ruby on Rails unobtrusive scripting adapter for jQueryを使っています。)
仕上げ
ルートにあるGemfileを開き,
gem 'rails', '3.0.6'
に書き換えて、最後に
bundle update rails
と実行して完了です。
・・・こんなにやらないとダメだったっけ?
まぁ、ちゃんとアップデートできたからいいや。