diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2012-01-05 20:15:52 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-01-05 20:16:09 -0200 |
commit | 675094b2757cf90399dadca4489b1036810ae570 (patch) | |
tree | ce698136f7fdd6eb89b97376b78812955d9ae68f /activemodel | |
parent | 0e8dda7eabb92384fb107b42339430f058166b7d (diff) | |
download | rails-675094b2757cf90399dadca4489b1036810ae570.tar.gz rails-675094b2757cf90399dadca4489b1036810ae570.tar.bz2 rails-675094b2757cf90399dadca4489b1036810ae570.zip |
More 1.9 way
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/lib/active_model/conversion.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/activemodel/lib/active_model/conversion.rb b/activemodel/lib/active_model/conversion.rb index 80a3ba51c3..c7c805f1a2 100644 --- a/activemodel/lib/active_model/conversion.rb +++ b/activemodel/lib/active_model/conversion.rb @@ -39,11 +39,9 @@ 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 - persisted? ? [id] : nil + key = respond_to?(:id) && id + key ? [key] : nil end # Returns a string representing the object's key suitable for use in URLs, |