Skip to content

Commit d0588a2

Browse files
committed
Merge pull request rails#13276 from aayushkhandelwal11/change_to_key
removing multiple check conditions to single check condition
2 parents 87e1e86 + 1889dcb commit d0588a2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

activemodel/lib/active_model/conversion.rb

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

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

0 commit comments

Comments
 (0)