aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-12-11 06:22:42 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-12-11 06:22:42 -0800
commitd0588a2e897d33c6c12e9fc5f8680328d37a26ca (patch)
treea70832e077b47b86fd3b07b2fb197821ab861beb /activemodel
parent87e1e86640fb8b5a260ff7c0044aaae58fff2bc4 (diff)
parent1889dcbc9f3140a4944176cec3db7e0c183cdab7 (diff)
downloadrails-d0588a2e897d33c6c12e9fc5f8680328d37a26ca.tar.gz
rails-d0588a2e897d33c6c12e9fc5f8680328d37a26ca.tar.bz2
rails-d0588a2e897d33c6c12e9fc5f8680328d37a26ca.zip
Merge pull request #13276 from aayushkhandelwal11/change_to_key
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,