diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-09 15:34:44 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-09 15:36:57 -0300 |
commit | c5448721b5054b8a467958d60427fdee15eac604 (patch) | |
tree | a7df11a0253a102b102558359bd896fb9f06611c /activerecord/lib/active_record/attribute_methods | |
parent | bc364afb9333cb7729452adf09fc70ccac510226 (diff) | |
download | rails-c5448721b5054b8a467958d60427fdee15eac604.tar.gz rails-c5448721b5054b8a467958d60427fdee15eac604.tar.bz2 rails-c5448721b5054b8a467958d60427fdee15eac604.zip |
to_key on a destroyed model should return nil
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/primary_key.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/primary_key.rb b/activerecord/lib/active_record/attribute_methods/primary_key.rb index e3f221c773..8bd898d126 100644 --- a/activerecord/lib/active_record/attribute_methods/primary_key.rb +++ b/activerecord/lib/active_record/attribute_methods/primary_key.rb @@ -7,7 +7,7 @@ module ActiveRecord # the record is not persisted? or has just been destroyed. def to_key key = send(self.class.primary_key) - [key] if key + persisted? && key ? [key] : nil end module ClassMethods |