Sha256: c8d02e96da74c362699b6ec90bdeb7ab459bc40f0ff891982f64b26c11961709

Contents?: true

Size: 390 Bytes

Versions: 4

Compression:

Stored size: 390 Bytes

Contents

module DestroyedAt
  module BelongsToAssociation
    def handle_dependency
      if load_target
        if options[:dependent] == :destroy && target.respond_to?(:destroyed_at)
          target.destroy(owner.destroyed_at)
        else
          super
        end
      end
    end
  end
end

ActiveRecord::Associations::BelongsToAssociation.send(:prepend, DestroyedAt::BelongsToAssociation)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
destroyed_at-0.4.0 lib/destroyed_at/belongs_to_association.rb
destroyed_at-0.3.1 lib/destroyed_at/belongs_to_association.rb
destroyed_at-0.3.0 lib/destroyed_at/belongs_to_association.rb
destroyed_at-0.2.0 lib/destroyed_at/belongs_to_association.rb