なるようになるブログ

読書感想文かrailsについてかrubyについてか

rails commit log流し読み(2018/03/30)

2018/03/30分のコミットです。

CHANGELOGにのったコミットは以下の通りです。

actionpack/CHANGELOG.md


Merge pull request #32243 from maschwenk/patch-2

railties/lib/rails/tasks/yarn.rakeの修正です。

yarn:installタスクで実行するyarnコマンドで、lockfileに差分があった場合にエラーになるよう、--freeze-lockfileオプションを指定するよう修正しています。

が、これは--frozen-lockfileの誤りの為、後ほど修正されています。


Merge pull request #32289 from gsamokovarov/did-you-mean-suggestions

railtiesの修正です。

generatorやserverのhandlerで値を間違えた際に表示するサジェストを作成するのに、レーベンシュタイン距離を使って独自の実装で行っていたのを、DidYouMean::SpellCheckerを利用するよう修正しています。


Fix "--frozen-lockfile" argument used in yarn install rake task

railties/lib/rails/tasks/yarn.rakeの修正です。

yarn:installタスクで実行するyarnコマンドで、--frozen-lockfileオプションを--freeze-lockfileにタイポしていたのを修正しています。


Remove unnecessary line break and quotes

railties/lib/rails/generators.rbの修正です。

generatorのサジェストに不要な改行とクォートが含まれていたのを修正しています。


Short circuit the scoping delegation for relation.all

activerecord/lib/active_record/relation/spawn_methods.rbの修正です。

SpawnMethods moduleにspawnのaliasとしてallを定義しています。

元々は、relation.allrelation.scoping { klass.all }という挙動になっていたのですが、現状はrelation.spawnと等価な振る舞いになったので、メソッド呼び出しを減らせるようaliasとして定義したようです。


Merge pull request #32338 from eugeneius/dont_clobber_foreign_key

activerecord/lib/active_record/associations/preloader/association.rbの修正です。

belongs_to associationを使用している、かつ、存在しないrecordをpreloadした際に、そのassociationのforeign keyが設定されないバグがあったのを修正しています。


Fix intermittent CI failure due to setting explicit person.id = 10

activerecord/test/cases/associations/has_many_associations_test.rbの修正です。

association経由でメソッドを呼び出した際にscopeが使われる事を確認するテストで、primary keyのidを固定で指定していたのを、指定しないよう修正しています。idを固定で指定してしまうとテストの実行順によってエラーになってしまう(そのidのデータが既に存在している事がありえる)為。


Adding missing extension for cattr_accessor method

activesupport/lib/active_support/message_encryptor.rbの修正です。

不足していたactive_support/core_ext/module/attribute_accessorsのrequireを追加しています。


Remove expired explanation [ci skip]

activerecord/lib/active_record/callbacks.rbのdocの修正です。

Callbacks moduleのdocに、既に出来なくなっているcallbackのオーバーライドのやり方についての説明が残ってしまっていたのを削除しています。


Remove shadowing variable warning

activerecord/lib/active_record/database_configurations.rbの修正です。

DatabaseConfig.walk_configsメソッドでRubyのwarning(warning: shadowing outer local variable - spec_name)が出ていたので、変数名を変更して対応しています。


Deprecate controller level force_ssl

actionpack/lib/action_controller/metal/force_ssl.rbの修正です。

Controller levelのforce_sslがdeprecateになりました。

サイト全体をSSLにしたい場合に、誤ってconfig.force_sslではなくController levelのforce_sslが使ってしまうケースが何度かあった、また、今はサイト全体をSSLにする事が一般的に求められており、Controller単位でhttp / httpsを切り替えたいというケースは殆ど無いだろう、という事で、deprecateになりました。