diff options
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 06bd2dab95..2eb2699949 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2494,6 +2494,11 @@ module ActiveRecord #:nodoc: @new_record || false end + # Returns true if this object has been destroyed, otherwise returns false. + def destroyed? + @destroyed || false + end + # :call-seq: # save(perform_validation = true) # @@ -2544,6 +2549,7 @@ module ActiveRecord #:nodoc: # options, use <tt>#destroy</tt>. def delete self.class.delete(id) unless new_record? + @destroyed = true freeze end @@ -2554,6 +2560,7 @@ module ActiveRecord #:nodoc: arel_table(true).where(arel_table[self.class.primary_key].eq(id)).delete end + @destroyed = true freeze end |