aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-03-14 17:43:59 -0700
committerwycats <wycats@gmail.com>2010-03-15 08:57:41 -0700
commit5de3698e2be1438d0fdc2b4ef2fe6adf0b94b343 (patch)
tree261726834da8a92774a49175be3345f7f7a5f93d /activerecord/lib/active_record/base.rb
parent96bc6bcfee704701de1a9c4c3c6a7c265610d34d (diff)
downloadrails-5de3698e2be1438d0fdc2b4ef2fe6adf0b94b343.tar.gz
rails-5de3698e2be1438d0fdc2b4ef2fe6adf0b94b343.tar.bz2
rails-5de3698e2be1438d0fdc2b4ef2fe6adf0b94b343.zip
cleaning up many more warnings in activerecord [#4180 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-xactiverecord/lib/active_record/base.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 0ce876d7a9..1488d9f967 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1042,6 +1042,9 @@ module ActiveRecord #:nodoc:
object.instance_variable_set(:'@attributes', record)
object.instance_variable_set(:'@attributes_cache', {})
object.instance_variable_set(:@new_record, false)
+ object.instance_variable_set(:@readonly, false)
+ object.instance_variable_set(:@destroyed, false)
+ object.instance_variable_set(:@marked_for_destruction, false)
object.send(:_run_find_callbacks)
object.send(:_run_initialize_callbacks)
@@ -1508,6 +1511,9 @@ module ActiveRecord #:nodoc:
@attributes_cache = {}
@new_record = true
@readonly = false
+ @destroyed = false
+ @marked_for_destruction = false
+
ensure_proper_type
if scope = self.class.send(:current_scoped_methods)
@@ -1599,12 +1605,12 @@ module ActiveRecord #:nodoc:
# Returns true if this object hasn't been saved yet -- that is, a record for the object doesn't exist yet; otherwise, returns false.
def new_record?
- @new_record || false
+ @new_record
end
# Returns true if this object has been destroyed, otherwise returns false.
def destroyed?
- @destroyed || false
+ @destroyed
end
# Returns if the record is persisted, i.e. it's not a new record and it was not destroyed.