aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-12-11 13:43:28 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-12-11 13:43:28 -0200
commit5853c64a4ba77134b7a4ff942b7ae711cb7bcc46 (patch)
tree81ee40a0fa86403f37b584a8d896a3b79d1e3078 /activemodel
parent929c2261cdb279d6184cc288d7ab014c1414799c (diff)
downloadrails-5853c64a4ba77134b7a4ff942b7ae711cb7bcc46.tar.gz
rails-5853c64a4ba77134b7a4ff942b7ae711cb7bcc46.tar.bz2
rails-5853c64a4ba77134b7a4ff942b7ae711cb7bcc46.zip
Revert "Merge pull request #13276 from aayushkhandelwal11/change_to_key"
This will call primary_key two times This reverts commit d0588a2e897d33c6c12e9fc5f8680328d37a26ca, reversing changes made to 87e1e86640fb8b5a260ff7c0044aaae58fff2bc4.
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/conversion.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/conversion.rb b/activemodel/lib/active_model/conversion.rb
index bfceb23852..21e4eb3c86 100644
--- a/activemodel/lib/active_model/conversion.rb
+++ b/activemodel/lib/active_model/conversion.rb
@@ -49,7 +49,8 @@ module ActiveModel
# person = Person.create
# person.to_key # => [1]
def to_key
- [id] if respond_to?(:id) && id
+ key = respond_to?(:id) && id
+ key ? [key] : nil
end
# Returns a +string+ representing the object's key suitable for use in URLs,