1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Revert "More 1.9 way"

This reverts commit 675094b275.
This commit is contained in:
Aaron Patterson 2012-01-05 17:05:21 -08:00
parent fd918fe5ed
commit 8350ce97f2

View file

@ -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,