aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-08-08 19:14:35 -0300
committerEmilio Tagua <miloops@gmail.com>2009-08-08 19:14:35 -0300
commit952014315926d370f2a0b681cb765948bf2e6883 (patch)
tree3abfe7e82554c09df4b2fe8a170e90cf1f0bcf02 /activerecord/lib/active_record/base.rb
parentae9e1e9f6d08bbd5f5c1512b72d495168e9fa5e5 (diff)
parented8a0a1c2370ab8715434ba824b2826d807401d5 (diff)
downloadrails-952014315926d370f2a0b681cb765948bf2e6883.tar.gz
rails-952014315926d370f2a0b681cb765948bf2e6883.tar.bz2
rails-952014315926d370f2a0b681cb765948bf2e6883.zip
Merge commit 'rails/master'
Conflicts: activerecord/test/cases/adapter_test.rb activerecord/test/cases/method_scoping_test.rb
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-xactiverecord/lib/active_record/base.rb7
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