module Kakurenbo::MixinARPersistence

Public Class Methods

included(base_class) click to toggle source

Override methods.

# File lib/kakurenbo/mixin_ar_persistence.rb, line 4
def self.included(base_class)
  base_class.class_eval do
    def destroy(options = {:hard => false})
      raise ReadOnlyRecord if readonly?
      destroy_associations
      #destroy_row(options) if persisted?
      destroy_row if persisted?
      @destroyed = true
      freeze
    end

    private
    def destroy_row(options = {:hard => false})
      relation_for_destroy.delete_all(nil, options)
    end
  end
end

Public Instance Methods

destroy(options = {:hard => false}) click to toggle source
# File lib/kakurenbo/mixin_ar_persistence.rb, line 6
def destroy(options = {:hard => false})
  raise ReadOnlyRecord if readonly?
  destroy_associations
  #destroy_row(options) if persisted?
  destroy_row if persisted?
  @destroyed = true
  freeze
end
destroy_row(options = {:hard => false}) click to toggle source
# File lib/kakurenbo/mixin_ar_persistence.rb, line 16
def destroy_row(options = {:hard => false})
  relation_for_destroy.delete_all(nil, options)
end