なるようになるブログ

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

rails commit log流し読み(2019/05/05)

2019/05/05分のコミットです。

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


Make generated test work even when using virtual attributes

railtiesの修正です。

generatorにattachmentrich_text attributeを指定した場合に生成されるテストコードが、実行するとエラーになってしまうコードだったのを修正しています。

rails commit log流し読み(2019/05/03)

2019/05/03分のコミットです。

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


Add Action Cable Release Notes [ci skip]

rails guideのRuby on Rails 6.0 Release Notesの修正です。

Action Cableの変更点についてRelease Notesに記載しています。


[ci skip] Correct the stylesheet name used in the guide.

rails guideのAction Text Overviewの修正です。

action_text:installが生成するスタイルシートのファイル名に誤りがあったのを修正しています。


Remove redundant test_too_many_binds

activerecord/test/cases/adapters/sqlite3/bind_parameter_test.rbを削除しています。

他のファイルに同じ内容のテストがある為。


Recover perf for pluck by reverting 9c9c950d02af83742a5f76302d0faa99508f242c.

deserialize処理で高速化の為に値をto_iで変換するようにしたSpeed up integer casting from DBをRevertした、Revert "Speed up integer casting from DB"をRevertし、変換処理を戻しています。

このRevertの影響でpluckの処理が遅くなってしまった為、処理速度を戻す為Revertしています。

rails commit log流し読み(2019/05/02)

2019/05/02分のコミットです。

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


Updates to getting started per Rails 6.0 changes [ci skip]

rails guideのGetting Started with Railsの修正です。

Rails 6.0の変更に合わせてguideを修正しています(CoffeeScriptmini_racer gemに関する説明を削除、model generatorでreferences typeを指定した場合にmigrationファイルにnull: falseを指定)。


Merge pull request #34642 from azimux/improve-hwia-initialize-by-skipping-to_h-if-already-a-hash

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

HashWithIndifferentAccess#initializeで引数に指定したオブジェクトがHashだった場合に、不要なto_hashメソッドの呼び出しを行わないよう修正しています。性能向上の為。


Merge pull request #35337 from abhaynikam/35265-remove-unused-argument-layout-from-rendered-template

Action Viewの修正です。

RenderedTemplateから使用していないlayout attributeを削除しています。


Merge pull request #36149 from alexcameron89/add_active_storage_rn

rails guideのRuby on Rails 6.0 Release Notesの修正です。

Active Storageの変更点についてRelease Notesに記載しています。


Make scope arity check consistent (#36134)

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

scopeの引数をチェックする際に、arityが0以上かどうかをチェックしていたのを、arityが0じゃないかどうかをチェックするよう修正しています。arityが負の値になる事がある為。

参考:Class: Proc (Ruby 2.6.2)


Update asset compression text [ci skip]

rails guideのGetting Started with Railsの修正です。

Starting up the Web Serverの項のJavaScriptに関する説明の言い回しを修正しています。


Merge pull request #36152 from prathamesh-sonpatki/active-support-notes

rails guideのRuby on Rails 6.0 Release Notesの修正です。

Active Supportの変更点についてRelease Notesに記載しています。


Namespace association extension modules under the owner model

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

association extension modulesを定義する際に、Objectに対してmoduleを追加していたのを、自身のmodelに対してmoduleを追加するよう修正しています。元の方法だと、autoloaderにZeitwerkを使用している場合に、定数の再定義が行われてしまい、結果Rubyのwarningが表示されてしまう為。

rails commit log流し読み(2019/05/01)

2019/05/01分のコミットです。

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


Remove dynamic_form gem references in guides

rails guideのRails Internationalization (I18n) APIの修正です。

ガイドからdynamic_form gemの説明を削除しています。もうメンテされておらず、Rails 4からは正常に動作しない為。


revert changes to monotonic times

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

ActiveSupport::Notifications::Fanoutで処理時間の計算にConcurrent.monotonic_timeを使うようになっていたのを、Time.nowに戻しています。

元々TimeインスタンスだったのがFloat(Concurrent.monotonic_timeの戻り値はFloat)になった事により、元々Timeインスタンスを期待していたアプリが動作しなくなった、Timeを返す事はドキュメントに記載していた挙動である、また、FloatTimeインスタンスに正しく変換する方法は無い、等の理由により修正されています。


any? should be delegated to the errors list

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

ActiveModel::Errors@errorsdelegateするメソッドにany?を追加しています。scaffoldで生成したコードがdeprecation warningが表示されずに動作するようにする為。


@controller may not be defined here, and if so, it causes a Ruby warning

actionview/lib/action_view/test_case.rbの修正です。

ActionView::TestCase@controllerを参照する前にdefined?で定義されているかどうかチェックするよう修正しています。


Remove database specific sql statements from SQLCounter

Active Recordのテストの修正です。

SQLCounterでmetadataを取得するSQLを無視する為に、adapter毎に無視するSQLのstatementsを定義しそのSQLと一致するかをチェックしていたのを、SCHEMA引数が定義されているかどうかでチェックするよう修正しています。


Active Model release notes [ci skip]

rails guideのRuby on Rails 6.0 Release Notesの修正です。

Active Modelの変更点についてRelease Notesに記載しています。

rails commit log流し読み(2019/04/30)

2019/04/30分のコミットです。

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


[ci skip] Add 6.0 Release Notes for Action View

rails guideのRuby on Rails 6.0 Release Notesの修正です。

Action Viewの変更点についてRelease Notesに記載しています。


Fix incorrect url in guide [ci skip]

rails guideのTesting Rails Applicationsの修正です。

Testing flash noticesの項にあるexampleコードで、url helperメソッドをタイポしていたのを修正しています。


Action Mailer release notes [ci skip]

rails guideのRuby on Rails 6.0 Release Notesの修正です。

Action Mailerの変更点についてRelease Notesに記載しています。


Fix rubocop offences

rubocopの設定に違反している箇所があったのをまとめて修正しています。


Should take the record's state of first action in the transaction

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

transaction内で同じIDのレコードに対して保存 / 削除処理を行った場合に、after_commitによるcallbackが正しく動作しないケースがあったのを修正しています。

rails commit log流し読み(2019/04/29)

2019/04/29分のコミットです。

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


Improve error message of ActiveSupport delegate

activesupport/lib/active_support/core_ext/module/delegation.rbの修正です。

delegateメソッドにto引数が指定されなかった場合のエラーメッセージで、to引数についてoptions hashと説明していたのを、keyword argumentに修正しています。

Update delegate to use newer Ruby syntaxでkeyword argumentを使用するよう修正されているため。


Extract _raise_record_not_touched_error

activerecord/lib/active_record/persistence.rbactiverecord/lib/active_record/touch_later.rbの修正です。

persistしていないrecordに対してtouchを呼び出し際に使用するエラーメッセージの生成処理を、処理毎に実装していたのを、メソッドに切り出して共通で使用するよう修正しています。