aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorAayush khandelwal <aayush.khandelwal@vinsol.com>2013-12-11 19:36:25 +0530
committerAayush khandelwal <aayush.khandelwal@vinsol.com>2013-12-11 19:36:25 +0530
commit1889dcbc9f3140a4944176cec3db7e0c183cdab7 (patch)
treec0d8a640f14eac728568d39d176593b282e8d030 /activemodel
parent11c0ef58a6cd278fc6b5d81a7724d9bcdb47f623 (diff)
downloadrails-1889dcbc9f3140a4944176cec3db7e0c183cdab7.tar.gz
rails-1889dcbc9f3140a4944176cec3db7e0c183cdab7.tar.bz2
rails-1889dcbc9f3140a4944176cec3db7e0c183cdab7.zip
removing multiple check conditions to single check condition
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/conversion.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/conversion.rb b/activemodel/lib/active_model/conversion.rb
index 21e4eb3c86..bfceb23852 100644
--- a/activemodel/lib/active_model/conversion.rb
+++ b/activemodel/lib/active_model/conversion.rb
@@ -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,