Adds the delete constraint options to a relationship
@param params [*ARGS] Arguments passed to Relationship#initialize
@return [nil]
@api private
# File lib/data_mapper/constraints/relationship/one_to_many.rb, line 38 def initialize(*args) super set_constraint assert_valid_constraint end
@api private
# File lib/data_mapper/constraints/relationship/one_to_many.rb, line 9 def enforce_destroy_constraint(resource) return true unless association = get(resource) constraint = self.constraint case constraint when :protect Array(association).empty? when :destroy, :destroy! association.__send__(constraint) when :set_nil Array(association).all? do |resource| resource.update(inverse => nil) end when :skip true # do nothing end end
Generated with the Darkfish Rdoc Generator 2.