aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
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,