なるようになるブログ

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

rails commit log流し読み(2018/06/12)

2018/06/12分のコミットです。

CHANGELOGへの追加はありませんでした。


Merge pull request #29939 from arthurchui/activerecord-delete-associations-loop

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

CollectionAssociation#remove_recordsメソッドでtargetから既にあるassociationを削除する際に、Array#deleteを使用していたのを、Hash#select!を使用するよう修正しています。

Hashの方が高速(Arrayだと計算量がO(N2)だけど、HashだとO(N))な為。が、これについては次のコミットで別な形で再度修正されています。


Use -= to change the update the collection on the association

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

CollectionAssociation#remove_recordsメソッドでtargetから既にあるassociationを削除するのに-=を使用するよう修正しています。

target=メソッドを使用すると、associationがload済みになり、次にreaderにアクセスする際にqueryの実行が抑止出来る為。が、これはこれで別の問題があった為、また次のコミットで修正されています。


Don't use target=

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

associationを削除するのにtarget=メソッドを使用せず、@targetを直接更新するよう修正しています。

ここでassociationをload済みにしてしまうと、オブジェクトが古い状態のままになってしまう場合がある為。


Merge pull request #32997 from utilum/dev_dep_guide_update_ast_requirements

Development Dependencies Install guideに Active Storageのテストで必要なパッケージ(ffmpegmupdf等)のインストール方法についての説明を追加しています。


Merge pull request #33092 from utilum/warnings_in_contribute_guide

rails guideのContributing to Ruby on Railsの修正です。

Warningsの項でRUBYOPT=-W0を指定するとwarningが表示されなくなる旨説明が記載されていたのですが、実際はその挙動にならない(warningは表示される)為、該当の説明を削除しています。


Merge pull request #33106 from marcandre/datecalc

activesupport/lib/active_support/core_ext/date_and_time/calculations.rbの修正です。

DateAndTime::Calculations moduleで曜日の管理をするのに、月曜が0になっていたのを、日曜が0になるよう修正しています。

曜日を計算するのにwdayから1引いてから計算する(Rubyのwdayは日曜が0ので、各メソッドでcurrent_day_number = wday != 0 ? wday - 1 : 6というのを最初にやっていた)という不要な処理を削除する為。


Fix bug with eager_load in development environment

actionpack/lib/action_dispatch/journey/routes.rbの修正です。

eager_loadをdevelopmentでtrueにしている、かつ、Routeが空の場合にArgumentErrorが発生してしまうバグがあったのを修正しています。


Remove backticks around proejct names

rails guideのActive Storage OverviewDevelopment Dependencies Installの修正です。

XQuartzやPoppler等のプロジェクト名をバッククォートで囲まないよう修正しています。


Fix active_model/errors docs [ci skip]

activemodel/lib/active_model/errors.rbのdocの修正です。

ActiveModel::Errors#full_messageメソッドのdocから不要なインデントを削除しています。


Add changelog for #32956 [ci skip]

activemodel/CHANGELOG.mdの修正です。

ActiveModel::Errors#full_messageメソッドで出力するエラーメッセージのフォーマットを変更出来るよう対応した、Allow to override the full_message error formatについてCHANGELOGにエントリーを追加しています。


Add comma to example in guides/source/active_storage_overview.md [ci skip]

rails guideのActive Storage Overviewの修正です。

Attaching File/IO Objectsの項にあるexampleコードでカンマが不足していたのを修正しています。


Remove reference to session_store.rb initializer

actionpack/lib/action_dispatch/middleware/session/cookie_store.rbの修正です。

既に存在しないinitializer(config/initializers/session_store.rb)に言及している箇所があったのを削除しています。