2019/07/26分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
activejob/CHANGELOG.md
Make sure AR can load without Rails
activerecord/lib/active_record/tasks/database_tasks.rb
の修正です。
DatabaseTasks.for_each
メソッドの先頭でRails
が定義されているかどうかをチェックし、定義されていない場合は空のHashを返すよう修正しています。
メソッドの中でRails
moduleの値を使用しており、Rails外でActive Recordを使用した場合にエラーになるのを避ける為。
Optimize DescendantsArray insertions
activesupport/lib/active_support/descendants_tracker.rb
の修正です。
DescendantTracker::DescendantArray#<<
でklassを追加する際に、参照先のオブジェクトが生きているかどうかをチェックし、GC済みのオブジェクトを除外していたのを、DescendantTracker::DescendantArray#each
で参照する際にGC済みのオブジェクトを除外するようにしています。処理高速化の為。
fix follow_redirect!
not using the same HTTP verb on 307 redirection:
actionpack/lib/action_dispatch/testing/integration.rb
の修正です。
follow_redirect!
でリダイレクトする際に、必ずGET
リクエストになっていたのが、元のリクエストのHTTPメソッドを使用するよう修正しています。HTTP 1.1の仕様では、307リダイレクトはメソッドとボディは変更されないようになっている為。
Merge pull request #36758 from jturkel/feature/hash-optimization
activesupport/lib/active_support/hash_with_indifferent_access.rb
の修正です。
HashWithIndifferentAccess#convert_value
メソッドのoptions
引数のデフォルト値をfreezeするよう修正しています。
Merge pull request #36412 from robotdana/compact_blank
actionpack/lib/action_controller/metal/strong_parameters.rb
の修正です。
ActionController::Parameters
にcompact_blank
、及び、compact_blank!
メソッドを追加しています。それぞれreject(&:blank?)
、reject!(&:blank?)
のショートハンド。
Merge pull request #36318 from itsWill/fix_event_object_payload
activesupport/lib/active_support/notifications/fanout.rb
、
activesupport/lib/active_support/notifications/instrumenter.rb
の修正です。
ActiveSupport::Notifications.instrument
に指定したblock内でpayloadを変更した際に、その変更内容をActiveSupport::Notifications.subscribe
で参照出来るよう修正しています。
read configuration to determine excluded eager loaded directory (#36354)
railties/lib/rails/engine/configuration.rb
の修正です。
eager loadの対象から除外されるディレクトリがassets
、javascript
に固定になっていたのを、assets
+ webpacker.yml
のsource_path
に指定されているディレクトリを除外するよう修正しています。source_path
をカスタマイズしている場合に正しく除外されるようにする為。
let autoloaded? support modules with overridden names [closes #36757]
activesupport/lib/active_support/dependencies.rb
、
activesupport/lib/active_support/dependencies/zeitwerk_integration.rb
の修正です。
name
を上書きしているmoduleについてもautoloaded?
で正しくチェック出来るよう修正しています。
Use connection.error_number in MySQLDatabaseTasks
activerecord/lib/active_record/tasks/mysql_database_tasks.rb
の修正です。
DBが作成済みかどうかをチェックする際に、mysql2 adapterが提供しているerror_number
を使用していたのを、connectionのerror_number
メソッドを使用するよう修正しています。mysql2以外のadapterでも動作するようにする為。
Merge pull request #36380 from edudepetris/ed/36272-better-negative-scope-warning
activerecord/lib/active_record/enum.rb
の修正です。
enumにnot_
ではじめる名前を使っている場合に、デフォルトで生成されるnegative scopeと名前がコンフリクトする旨メッセージを表示するよう修正しています。
Use binding.local_variable_get for :for
activesupport/lib/active_support/hash_with_indifferent_access.rb
の修正です。
HashWithIndifferentAccess#convert_value
メソッドの引数の指定にキーワード引数を指定 + binding.local_variable_get
を使用するようにして、そもそもoptions
引数を削除するようリファクタリングしています。
activesupport/lib/active_support/hash_with_indifferent_access.rb
の修正です。
先のリファクタリングで修正漏れがあったのを対応しています。
Merge pull request #36731 from jhawthorn/dir_glob_base_instead_of_chdir
railties/lib/rails/paths.rb
の修正です。
Paths#files_in
メソッドで、Dir.chdir
でpathを変更してからDir.glob
を実行していたのを、Dir.glob
のbase
オプションにpathを指定するようにして、Dir.chdir
の呼び出しをを削除するようリファクタリングしています。
Only merge DATABASE_URL settings into the current env
activerecord/lib/active_record/database_configurations.rb
の修正です。
DATABASE_URL
を指定していた場合、現在のenv以外だけでなく全てのenvにその指定した値が影響してしまうバグがあったのを修正しています。
Merge pull request #36747 from y-yagi/add_mention_about_collection_cache_versioning
railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt
の修正です。
デフォルトで生成されるnew_framework_defaults_6_0.rb
にRails.application.config.active_record.collection_cache_versioning
についての説明を追加しています。
Merge pull request #36765 from kylekeesling/patch-1
actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb
の修正です。
develiomentで検証用にinbound mailを作成する際に、添付ファイルのファイル名が保持されてなかったのを保持するよう修正しています。
Merge pull request #36767 from vlado/active_job_test_helper_can_now_handle_relative_at_options
activejob/lib/active_job/test_helper.rb
の修正です。
assert_enqueued_with
とassert_enqueued_with
メソッドのat
オプションに相対時間(e.g. at: 5.minutes.from_now)
)を指定した場合に、microsecondsの値を0にするよう修正しています。
assertionとjob呼び出しの間にmicrosecondsが変わってしまい、その影響でassertionが失敗するのを避ける為。
Merge pull request #36576 from mtsmfm/mtsmfm/fix-fixture-resolver
actionview/lib/action_view/testing/resolvers.rb
の修正です。
ActionView::FixtureResolver
に:any
variantsのサポートを追加しています。
Correct assertion argument order
actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb
の修正です。
添付ファイル名をチェックするテストで、assert_equal
メソッドの引数が逆(actual、expectedの順になっていた)になっていたのを修正しています。
Fix flaky test ActionControllerBaseRenderTest#test_direct_render_to_string
actionpack/test/controller/render_test.rb
の修正です。
modify_template
で使用するテンプレートと、通常テストで使用するテンプレートが別になるよう修正しています。modify_template
ではテンプレートの内容を変更しており、同じテンプレートを参照するとタイミングによってはテストが失敗してしまう為(期待している結果とテンプレートの内容が変わってしまっている為)。
Merge pull request #36005 from shioyama/plain_matcher_first
activemodel/lib/active_model/attribute_methods.rb
の修正です。
attribute methodを検索する際に、prefixとsuffixの指定の無いplain matcherを最後に取得するようにして(優先度を下げる為)いたのを、最初に取得するよう修正しています。現状の実装では、plain matcherを最後に使用する必要は無いだろう、とのことです。
Use correct variable in secure_compare!
activesupport/lib/active_support/secure_compare_rotator.rb
の修正です。
ActiveSupport::SecureCompareRotator#secure_compare!
メソッドで参照するインスタンス変数をタイポしていたのを修正しています。
Merge pull request #36180 from jonathanhefner/optimize-string-from
activesupport/lib/active_support/core_ext/string/access.rb
の修正です。
String#from
、String#to
メソッドで不要なRangeオブジェクトが生成されないようリファクタリングしています。
Merge pull request #35334 from sharang-d/digest-doc-update
actionview/lib/action_view/digestor.rb
のdocの修正です。
ActionView::Digestor.digest
メソッドのdocに説明が不足していたformat
引数についての説明を追加しています。
Merge pull request #36300 from okuramasafumi/make-handle-options-private
actionpack/lib/action_dispatch/middleware/cookies.rb
の修正です。
内部でだけ使用するCookieJar#handle_options
メソッドの可視性をprivateに変更しています。
[ci skip] add CSRF token explanation for javascript documentation
rails guideのWorking with JavaScript in Rails
の修正です。
CSRF tokenを独自に作成したAJAXリクエストで送信する方法について説明した、Cross-Site Request Forgery (CSRF) token in Ajax
の項を追加しています。
Add a default value for arg format
in ActionView::Digestor.digest()
actionview/lib/action_view/digestor.rb
の修正です。
ActionView::Digestor.digest
のformat
引数のデフォルト値にnil
を指定するよう修正しています。5.2まではformat
オプションは無く、下位互換の為デフォルト値を指定するようにしています。
Fix join middle table alias when using HABTM
activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb
の修正です。
HABTMの結合に使用するmiddle tableのaliasをjoinした場合に、エラーになってしまうバグがあったのを修正しています。
Prettify diff generated by git for encripted file:
railtiesの修正です。
credentialsの編集内容をgit diff
/ git log
で見れるよう対応しています。
例。
diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc index 2475c8c..53bba7c 100644 --- a/config/credentials.yml.enc +++ b/config/credentials.yml.enc @@ -1,6 +1,6 @@ -# aws: -# access_key_id: 123 -# secret_access_key: 345 +aws: + access_key_id: 123 + secret_access_key: 345
表示には.gitattributes
を使用しており、git config
にdiff.rails_credentials.textconv 'bin/rails credentials:show'
を設定 + .gitattributes
にdiff内容を保存、という形で対応してます。
そのため、.gitattributes
とgit config
の設定が必要です。credentials:edit
実行時にその設定を行うかどうかのプロンプトが表示されるので、そのプロンプトをOKした場合それらの設定が行われるようになっています。
railties/test/application/rake_test.rb
の修正です。
scaffoldのテスト内で行っていたwebpacker:compile
を削除しています。テスト用アプリ構築時にcompileを行うようになっており、このタイミングでは不要な為。