Sha256: 26623750d3ed26ee732f8b5fbfe15989fcdb39d10e10743d8010702b765bf099

Contents?: true

Size: 387 Bytes

Versions: 4

Compression:

Stored size: 387 Bytes

Contents

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

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