From 1889dcbc9f3140a4944176cec3db7e0c183cdab7 Mon Sep 17 00:00:00 2001 From: Aayush khandelwal Date: Wed, 11 Dec 2013 19:36:25 +0530 Subject: removing multiple check conditions to single check condition --- activemodel/lib/active_model/conversion.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'activemodel') 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, -- cgit v1.2.3