Skip to content
Browse files

removing multiple check conditions to single check condition

  • Loading branch information...
1 parent 11c0ef5 commit 1889dcbc9f3140a4944176cec3db7e0c183cdab7 @aayushkhandelwal11 aayushkhandelwal11 committed Dec 11, 2013
Showing with 1 addition and 2 deletions.
  1. +1 −2 activemodel/lib/active_model/conversion.rb
View
3 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,

0 comments on commit 1889dcb

Please sign in to comment.
Something went wrong with that request. Please try again.