Permalink
Browse files

Don't check if persisted is defined just initialize it properly

  • Loading branch information...
1 parent 844b9a5 commit b0f6349a078969b83d23afa6e878de21d1b5d285 @spastorino spastorino committed Nov 9, 2010
@@ -1393,7 +1393,7 @@ def encode_quoted_value(value) #:nodoc:
def initialize(attributes = nil)
@attributes = attributes_from_column_definition
@attributes_cache = {}
- @persited = false
+ @persisted = false
@readonly = false
@destroyed = false
@marked_for_destruction = false
@@ -4,7 +4,6 @@ module Persistence
# 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 @@ def destroyed?
# 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
@@ -299,7 +299,6 @@ def remember_transaction_record_state #:nodoc
@_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)

0 comments on commit b0f6349

Please sign in to comment.