mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
aa202adf6c
Patches `CollectionAssociation#count` to return 0 without querying if the parent record is new. Consider the following code: class Account has_many :dossiers end class Dossier belongs_to :account end a = Account.new a.dossiers.build # before patch a.dossiers.count # SELECT COUNT(*) FROM "dossiers" WHERE "dossiers"."account_id" IS NULL # => 0 # after a.dosiers.count # fires without sql query # => 0 Fixes #1856. |
||
---|---|---|
.. | ||
active_record | ||
rails/generators | ||
active_record.rb |