Module: Millstone::ActiveRecord::Extension::ClassMethods::InstanceMethods

Defined in:
lib/millstone/active_record/extension.rb

Instance Method Summary collapse

Instance Method Details

#deleted?Boolean

Returns:

  • (Boolean)


119
120
121
# File 'lib/millstone/active_record/extension.rb', line 119

def deleted?
  !millstone_column_value.nil?
end

#destroyObject



91
92
93
94
95
96
97
98
99
100
# File 'lib/millstone/active_record/extension.rb', line 91

def destroy
  with_transaction_returning_status do
    _run_destroy_callbacks do
      raise AlreadyMarkedDeletion, "#{self.class.name} ID=#{self.id} already marked deletion." unless self.millstone_column_value.nil?
      self.class.delete(self.id)
      self.millstone_column_value = self.class.millstone_generate_column_value
      freeze
    end
  end
end

#destroy!Object



102
103
104
105
106
107
108
109
# File 'lib/millstone/active_record/extension.rb', line 102

def destroy!
  with_transaction_returning_status do
    _run_destroy_callbacks do
      self.class.delete!(self.id)
      freeze
    end
  end
end

#millstone_column_valueObject



123
124
125
# File 'lib/millstone/active_record/extension.rb', line 123

def millstone_column_value
  self.send(self.class.millstone_column)
end

#recover(options = {}) ⇒ Object



111
112
113
# File 'lib/millstone/active_record/extension.rb', line 111

def recover(options = {})
  raise "Millstone is not support"
end

#recover_dependent_associations(window, options = {}) ⇒ Object



115
116
117
# File 'lib/millstone/active_record/extension.rb', line 115

def recover_dependent_associations(window, options = {})
  raise "Millstone is not support"
end