2019/02/27分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Fix different
count
calculation when usingsize
with manualselect
with DISTINCT. - Add negative scopes for all enum values.
fixes different count
calculation when using size
manual select
with DISTINCT
activerecord/lib/active_record/relation/calculations.rb
の修正です。
select
にDISTINCT
を指定 + count
を使用した場合に、relationがload済みかどうかで結果が変わる(relationがloadされていない場合、select
部分が無視されたcount
が実行される)バグがあったのを修正しています。
[ActiveStorage] Ensure that the _blob
association is properly loaded when attaching ::One
activestorage/lib/active_storage/attached/changes/create_one.rb
の修正です。
has_one_attached
メソッドを使用している場合に、attachment save時にxx_blob
associationが正しくロードされないバグがあったのを修正しています。
Fix random CI failure due to non-deterministic sorting order
activerecord/test/cases/relations_test.rb
の修正です。
assertionで値を比較する際に、値をidでsortしてからチェックするよう修正しています。 sortを指定しないと結果が不定になる為。
Test that no datetime precision isn't truncated on assignment
activerecord/test/cases/date_time_precision_test.rb
、
activerecord/test/cases/time_precision_test.rb
の修正です。
値指定時にdatetime precisionが切り捨てられない事を確認するテストを追加しています。
Don't cache find_by
statements on STI subclasses
activerecord/lib/active_record/core.rb
の修正です。
STIのサブクラスでfind_by
文をキャッシュしないよう修正しています。
type IN (?,?,?,?)
部分が動的に変わる(サブクラス毎に変わる)為。
Merge pull request #35411 from rails/pass-locals-to-template
Action Viewの修正です。
ActionView::Template#initialize
の引数にlocals
を指定するのを必須にするよう修正しています(この時点では互換性の為に値を指定しないでも問題無いようになっていま)。
No nil format on templates や、Template has one variant と同様の対応で、template object生成時に必要な値を全て保持出来るようにする為。
Fix code examples' indentation in ActionDispatch::Routing [ci skip]
actionpack/lib/action_dispatch/routing.rb
のdocの修正です。
ActionDispatch::Routing
moduleのdoc内のexampleコードのインデントがおかしくなっていたのを修正しています。
Add negative scopes for all enum values (#35381)
activerecord/lib/active_record/enum.rb
の修正です。
enum
定義時にnegative scope(not_xxx
)も定義するよう修正しています。
class Post < ActiveRecord::Base enum status: %i[ drafted active trashed ] end Post.not_drafted # => where.not(status: :drafted) Post.not_active # => where.not(status: :active) Post.not_trashed # => where.not(status: :trashed)
activerecord/test/cases/enum_test.rb
の修正です。
不要なスペースを削除するよう修正しています。
Fix preload with nested associations
activerecord/lib/active_record/associations/preloader/through_association.rb
の修正です。
through associationのpreload処理で、middle recordがnilの場合にassociationのreset処理を行わないよう修正しています。
nestしたassociationをpreloadする際にmiddle recordがnilになってしまう事があり、その場合にエラーになってしまうのを避ける為。
Run activesupport's memcache store tests on Buildkite
Active Supportの修正です。
テストの際に使用するmemcache serverをMEMCACHE_SERVERS
env経由で指定するよう修正しています。memcache storeに関するテストがBuildkite上で動作するようにする為。
Fix test that was broken by adding a default scope to an existing model
Active Recordのテストの修正です。
先の、Fix preload with nested associationsの修正の際に、既存のmodelのdefault_scope
を追加したのですが、その影響で既存のテストが壊れてしまったので、default_scope
を指定する為のmodelを既存のmodelとは別に定義するよう修正しています。
Fix random CI failure due to non-deterministic sorting order
activerecord/test/cases/scoping/default_scoping_test.rb
の修正です。
assertionで値を比較する際に、値をidでsortしてからチェックするよう修正しています。 sortを指定しないと結果が不定になる為。
activerecord/test/cases/scoping/default_scoping_test.rb
の修正です。
インデントがずれてしまった箇所があったのを修正しています。