LoginSignup
1
2

More than 5 years have passed since last update.

Rails version update 覚書 その3

Posted at

前回 https://qiita.com/takakuda/items/f7ea279778971b71cd9b

依存関係のあるgemを一通りupdateし終えたらrails自体のupdateをする

rails update

Gemfileを編集する

- gem "rails", "5.1.~"
+ gem "rails", "5.2.~"

--conservative optionを使って依存関係のあるgemのupdateを行わないようにする

bundle update  --conservative rails

その1 https://qiita.com/takakuda/items/895bd6e776e8e7ec08bf
こちらの手順を実行していく。
依存関係のあるgemの更新が終了していればbundle update自体は成功するはず

bundle updateが成功したらちゃんとrailsが起動できるかを確認していく

たぶん起動しないので起動しない原因を調査し、1つずつ修正していく
今回は実際に自分がupdateしたときに発生した修正箇所もろもろ

ArgumentError: Passing string to be evaluated in :if and :unless conditional options is not supported. Pass a symbol for an instance method, or a lambda, proc or block, instead.

:if, :unless を使っている時にstringがサポートされなくなりました

☓ if: 'first_name.blank?'
○ if: proc { |s| s.first_name.blank? }

error messageに書いてある通りに対応すれば大丈夫です

undefined method halt_callback_chains_on_return_false= for ActiveSupport:Module (NoMethodError)

halt_callback_chains_on_return_falseはRails 4との後方互換のためのメソッド。
5.2よりhalt_callback_chains_on_return_falseは削除されたため、config/initializers/new_framework_defaults.rbの中のhalt_callback_chains_on_return_falseの行をコメントアウトすればおっけー。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2