Skip to content

Commit a83451d

Browse files
Alex Barretp8
andcommitted
Update ActiveRecord::Associations::CollectionProxy#== documentation
[ci skip] The current documentation for #== shows an example that demonstrates an incorrect behaviour. This change updates the example accordingly and adds a note too. Co-authored-by: Petrik de Heus <[email protected]>
1 parent 586436d commit a83451d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

activerecord/lib/active_record/associations/collection_proxy.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,10 +955,13 @@ def scope
955955
# person.pets == other
956956
# # => true
957957
#
958+
#
959+
# Note that unpersisted records can still be seen as equal:
960+
#
958961
# other = [Pet.new(id: 1), Pet.new(id: 2)]
959962
#
960963
# person.pets == other
961-
# # => false
964+
# # => true
962965
def ==(other)
963966
load_target == other
964967
end

0 commit comments

Comments
 (0)