aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-11-09 16:00:02 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2010-11-09 16:00:02 -0200
commit75dfd95618310a9522a73d8126b35351c8189042 (patch)
tree68ac697c0c048c463c98acace349bc0c26de591b /activerecord
parent994a1c2a4747efcca3c6278c119096d93f793da1 (diff)
downloadrails-75dfd95618310a9522a73d8126b35351c8189042.tar.gz
rails-75dfd95618310a9522a73d8126b35351c8189042.tar.bz2
rails-75dfd95618310a9522a73d8126b35351c8189042.zip
Don't check if persisted is defined just initialize it properly
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/base.rb2
-rw-r--r--activerecord/lib/active_record/persistence.rb2
-rw-r--r--activerecord/lib/active_record/transactions.rb1
3 files changed, 1 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 3e295eeaae..f588475bbf 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1368,7 +1368,7 @@ MSG
def initialize(attributes = nil)
@attributes = attributes_from_column_definition
@attributes_cache = {}
- @persited = false
+ @persisted = false
@readonly = false
@destroyed = false
@marked_for_destruction = false
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index f905b7026b..390e09d826 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -4,7 +4,6 @@ module ActiveRecord
# Returns true if this object hasn't been saved yet -- that is, a record
# for the object doesn't exist in the data store yet; otherwise, returns false.
def new_record?
- @persisted = false unless defined?(@persisted)
!@persisted
end
@@ -16,7 +15,6 @@ module ActiveRecord
# Returns if the record is persisted, i.e. it's not a new record and it was
# not destroyed.
def persisted?
- @persisted = false unless defined?(@persisted)
!!@persisted && !destroyed?
end
diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb
index 851ec62381..8c94d1a2bc 100644
--- a/activerecord/lib/active_record/transactions.rb
+++ b/activerecord/lib/active_record/transactions.rb
@@ -299,7 +299,6 @@ module ActiveRecord
@_start_transaction_state ||= {}
unless @_start_transaction_state.include?(:persisted)
@_start_transaction_state[:id] = id if has_attribute?(self.class.primary_key)
- @persisted = false unless defined?(@persisted)
@_start_transaction_state[:persisted] = @persisted
end
unless @_start_transaction_state.include?(:destroyed)