1
0
Fork 0
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:
Rafael Mendonça França 2013-12-11 06:22:42 -08:00
commit d0588a2e89

View file

@ -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,