aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-01-05 17:05:21 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-01-05 17:05:44 -0800
commit8350ce97f2065eed9638c595d3938a573d6fa343 (patch)
tree9307cb0909f7e4301c560edc111072c1ebcb755f /activemodel/lib
parentfd918fe5eda59e2ab081662827fc87868e6b70f2 (diff)
downloadrails-8350ce97f2065eed9638c595d3938a573d6fa343.tar.gz
rails-8350ce97f2065eed9638c595d3938a573d6fa343.tar.bz2
rails-8350ce97f2065eed9638c595d3938a573d6fa343.zip
Revert "More 1.9 way"
This reverts commit 675094b2757cf90399dadca4489b1036810ae570.
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/conversion.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/conversion.rb b/activemodel/lib/active_model/conversion.rb
index c7c805f1a2..80a3ba51c3 100644
--- a/activemodel/lib/active_model/conversion.rb
+++ b/activemodel/lib/active_model/conversion.rb
@@ -39,9 +39,11 @@ module ActiveModel
# Returns an Enumerable of all key attributes if any is set, regardless
# if the object is persisted or not.
+ #
+ # Note the default implementation uses persisted? just because all objects
+ # in Ruby 1.8.x responds to <tt>:id</tt>.
def to_key
- key = respond_to?(:id) && id
- key ? [key] : nil
+ persisted? ? [id] : nil
end
# Returns a string representing the object's key suitable for use in URLs,