Skip to content

Commit 5853c64

Browse files
committed
Revert "Merge pull request rails#13276 from aayushkhandelwal11/change_to_key"
This will call primary_key two times This reverts commit d0588a2, reversing changes made to 87e1e86.
1 parent 929c226 commit 5853c64

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

activemodel/lib/active_model/conversion.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ def to_model
4949
# person = Person.create
5050
# person.to_key # => [1]
5151
def to_key
52-
[id] if respond_to?(:id) && id
52+
key = respond_to?(:id) && id
53+
key ? [key] : nil
5354
end
5455

5556
# Returns a +string+ representing the object's key suitable for use in URLs,

0 commit comments

Comments
 (0)