2021/04/13分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Allow passing SQL as
returning
statement to#upsert_all
- Allow passing SQL as
on_duplicate
value to#upsert_all
to make it possible to use raw SQL to update columns on conflict
- Fix
ActiveSupport::TimeZone#utc_to_local
with fractional seconds. - Freeze
ActiveSupport::Duration#parts
and remove writer methods.
Remove Rack::Runtime and deprecate referencing it
railtiesの修正です。
デフォルトのmiddleware stackから、Rack::Runtime
を削除しています。
runtime headerは、timing attacksを受ける可能性がある事、及びstreamingレスポンスでは正確な数字が返せない、という事から、デフォルトからは削除したとの事です。合わせて、Rack::Runtime
を参照した際にdeprecateメッセージを出す為のmiddleware(MiddlewareStack::FakeRuntime
)を追加しています。
Don't define methods using the method modifier in the same line as the method
method modifier(ruby2_keywords
)とmethodの定義を同じ行で行わないよう修正しています。style guideで同じ行で定義する事を推奨していない為。
Merge pull request #41933 from palkan/feat/upsert-all-returning-update-sql
Active Recordの修正です。
#upsert_all
のreturning
statementにSQLを指定出来るよう修正しています。
Article.insert_all( [ { title: "Article 1", slug: "article-1", published: false }, { title: "Article 2", slug: "article-2", published: false } ], returning: Arel.sql("id, (xmax = '0') as inserted, name as new_name") )
合わせて、#upsert_all
の重複の条件を指定するon_duplicate
オプションにSQLを指定出来るよう修正しています。
Book.upsert_all( [{ id: 1, status: 1 }, { id: 2, status: 1 }], on_duplicate: Arel.sql("status = GREATEST(books.status, EXCLUDED.status)") )
Merge pull request #41931 from MarcelEeken/deep-merge-changing-original-hash
activesupport/lib/active_support/core_ext/hash/deep_merge.rb
の修正です。
Hash#deep_merge
にnestしたHash
を指定した際に、nestした先の値がdup
されない(元の値の参照が使われていた)バグがあったのを修正しています。
が、この対応によりvalueの変換結果が以前と変わってしまうケースがあった為、後ほどRevertされています。
Allow to opt-in to the new TimeWithZone.name and fix XmlMini serialization
Active Supportの修正です。
Deprecate ActiveSupport::TimeWithZone.nameでdeprecateにったActiveSupport::TimeWithZone.name
メソッドをconfig(config.active_support.remove_deprecated_time_with_zone_name
)で削除出来るよう修正しています。
Merge pull request #41925 from jbampton/fix-grammar
rails guideのSecurity Policy
の修正です。
Reporting a Vulnerability
の項のグラマーの修正を行っています。
Merge pull request #41926 from jbampton/fix-favorite
Active Recordのテストの修正です。
favourite
をfavorite
に修正しています。
Merge pull request #41899 from sebastian-palma/add-for-docs
activerecord/lib/active_record/relation/query_methods.rb
のdocの修正です。
QueryMethods#from
のdocに、from
を複数指定した場合の対応方法についての説明を追加しています。
Merge pull request #41910 from jbampton/add-github-actions
.github/workflows/lint.yml
の修正です。
CIでmisspell
を実行するよう設定を追加しています。
Merge pull request #41911 from Shopify/simplify-proxy-call
Active Model、Active Recordの修正です。
attribute methods を定義する際に明示的に引数を渡せるようにして、引数を受け取った際に不要なオブジェクトが生成されないよう修正しています。
Restore the Entry#bytesize comments removed in #41882
activesupport/lib/active_support/cache.rb
のdocの修正です。
Refactor LocalCache to avoid calling Marshal.dump as muchで削除したEntry#bytesize
メソッドのdocを戻しています。
Fix HTML tag mismatches in Action Text README [ci skip]
rails guideのAction Text Overview
の修正です。
action-text-attachment
の出力例で閉じタグのタグ名が過っていたのを修正しています。
Make sure establish_connection
with symbol work properly
activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb
、
activerecord/lib/active_record/connection_adapters/pool_config.rb
の修正です。
establish_connection
にSymbolを指定していた場合に、preventing_writes?
を呼び出した際にエラーになってしまうバグがあったのを修正しています。
Fix grammar and clarity [ci skip]
rails guideのContributing to Ruby on Rails
の修正です。
各箇所のグラマー、言い回しを修正しています。
docs: change user name
to the more used username
docの修正です。
user name
をusername
に修正しています。
Fix ActiveSupport::TimeZone#utc_to_local
activesupport/lib/active_support/values/time_zone.rb
の修正です。
utc_to_local_returns_utc_offset_times
がfalse、かつ、time instanceがfractional secondを保持していた場合に、ActiveSupport::TimeZone#utc_to_local
の結果が正しい値にならないバグがあったのを修正しています。
Freeze ActiveSupport::Duration#parts hash
activesupport/lib/active_support/duration.rb
、
activesupport/lib/active_support/time_with_zone.rb
の修正です。
ActiveSupport::Duration#parts
をfreeze + 不要なwriterメソッドの削除を行っています。
Revert "Merge pull request #41931 from MarcelEeken/deep-merge-changing-original-hash"
Hash#deep_merge
にnestしたHash
を指定した際にnestした先の値がdup
されないバグがあったのを修正した、Merge pull request #41931 from MarcelEeken/deep-merge-changing-original-hashをRevertしています。breaking changeが発生してしまっていた為。
Fix spelling in EncryptionSchemesTest
activerecord/test/cases/encryption/encryption_schemes_test.rb
の修正です。
テスト名のタイポを修正しています。
Fix spelling in Encryptor.encrypt docs [ci skip]
activerecord/lib/active_record/encryption/encryptor.rb
のdocの修正です。
Encryptor.encrypt
メソッドのdoc内のタイポを修正しています。
Fix: assign previous encryption schemes via previous: config option.
activerecord/lib/active_record/encryption/configurable.rb
の修正です。
ActiveRecord::Encryption.configure
メソッドでinternal configを上書きが正しく出来ていないバグがあったのを修正しています。
Fix spelling of EnvelopeEncryptionPerformanceTest
activerecord/test/cases/encryption/performance/envelope_encryption_performance_test.rb
の修正です。
クラス名のタイポを修正しています。
Fix spelling in AsynchronousQueryInsideTransactionError docs [ci skip]
activerecord/lib/active_record/errors.rb
のdocの修正です。
AsynchronousQueryInsideTransactionError
クラスのdoc内のタイポを修正しています。
Fix "warning: instance variable @previous_delivery_method not initialized"
actionmailer/test/test_helper_test.rb
の修正です。
テストの後処理で参照するインスタンス名が誤っていたのを修正しています。
Merge pull request #41942 from caffkane/as-twz-dep-warn-correction
activesupport/lib/active_support/time_with_zone.rb
の修正です。
ActiveSupport::TimeWithZone
で出力deprecateメッセージ内のタイポを修正しています。
chore: fix spelling in controller/filters_test.rb
actionpack/test/controller/filters_test.rb
の修正です。
クラス名のタイポを修正しています。
Merge pull request #41930 from Shopify/optimize-hstore-parser
activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb
の修正です。
Hstoreのpayloadsをparseするのに、StringScanner
を使用するよう修正しています。処理高速化の為。
docs: lint Markdown for four rules
rails guideの修正です。
各guideについて、不要な空白の削除、フォーマットの修正等を行っています。
Fix spelling in FixtureResolverTest
actionview/test/template/testing/fixture_resolver_test.rb
の修正です。
テスト内のタイポを修正しています。
Fix spelling in HasOneAssociationsTest
activerecord/test/cases/associations/has_one_associations_test.rb
の修正です。
クラス名のタイポを修正しています。