mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #13276 from aayushkhandelwal11/change_to_key
removing multiple check conditions to single check condition
This commit is contained in:
commit
d0588a2e89
1 changed files with 1 additions and 2 deletions
|
@ -49,8 +49,7 @@ module ActiveModel
|
|||
# person = Person.create
|
||||
# person.to_key # => [1]
|
||||
def to_key
|
||||
key = respond_to?(:id) && id
|
||||
key ? [key] : nil
|
||||
[id] if respond_to?(:id) && id
|
||||
end
|
||||
|
||||
# Returns a +string+ representing the object's key suitable for use in URLs,
|
||||
|
|
Loading…
Reference in a new issue