Permalink
Browse files

Merge pull request #13276 from aayushkhandelwal11/change_to_key

removing multiple check conditions to single check condition
  • Loading branch information...
2 parents 87e1e86 + 1889dcb commit d0588a2e897d33c6c12e9fc5f8680328d37a26ca @rafaelfranca rafaelfranca committed Dec 11, 2013
Showing with 1 addition and 2 deletions.
  1. +1 −2 activemodel/lib/active_model/conversion.rb
@@ -49,8 +49,7 @@ def to_model
# 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,

2 comments on commit d0588a2

Owner

@spastorino good catch. Please revert.

Please sign in to comment.