Sha256: d25d26953f851d65d81e236eea8e39d886d731adf329f0d74d0b318c0598de71

Contents?: true

Size: 825 Bytes

Versions: 10

Compression:

Stored size: 825 Bytes

Contents

require 'dm-core'
require 'dm-constraints/delete_constraint'

module DataMapper
  module Associations

    class OneToMany::Relationship

      include DataMapper::Hook
      include Constraints::DeleteConstraint

      OPTIONS << :constraint

      attr_reader :constraint

      # initialize is a private method in Relationship
      # and private methods can not be "advised" (hooked into)
      # in extlib.
      with_changed_method_visibility(:initialize, :private, :public) do
        before :initialize, :add_constraint_option
      end

    end

    class ManyToMany::Relationship

      OPTIONS << :constraint

      private

      # TODO: document
      # @api semipublic
      chainable do
        def one_to_many_options
          super.merge(:constraint => @constraint)
        end
      end
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dm-constraints-1.1.0 lib/dm-constraints/relationships.rb
dm-constraints-1.1.0.rc3 lib/dm-constraints/relationships.rb
dm-constraints-1.1.0.rc2 lib/dm-constraints/relationships.rb
dm-constraints-1.1.0.rc1 lib/dm-constraints/relationships.rb
dm-constraints-1.0.2 lib/dm-constraints/relationships.rb
dm-constraints-1.0.1 lib/dm-constraints/relationships.rb
dm-constraints-1.0.0 lib/dm-constraints/relationships.rb
dm-constraints-1.0.0.rc3 lib/dm-constraints/relationships.rb
dm-constraints-1.0.0.rc2 lib/dm-constraints/relationships.rb
dm-constraints-1.0.0.rc1 lib/dm-constraints/relationships.rb