def define_associate_instance_setter_method(associate)
      define_method "#{associate.name}=" do |object|
        unless object.is_a?(associate.klass)
          raise ArgumentError, "#{associate.klass}(##{associate.klass.object_id}) expected, got #{object.class}(##{object.class.object_id})"
        end

        instance = instance_variable_set("@#{associate.name}", object)

        depending = associates.select { |_associate| _associate.dependent_names.include?(associate.name) }
        depending.each do |_associate|
          send(_associate.name).send("#{associate.name}=", instance)
        end

        instance
      end
    end
def define_associate_instance_setter_method(associate)
      define_method "#{associate.name}=" do |object|
        unless object.is_a?(associate.klass)
          raise ArgumentError, "#{associate.klass}(##{associate.klass.object_id}) expected, got #{object.class}(##{object.class.object_id})"
        end

        instance = instance_variable_set("@#{associate.name}", object)

        depending = associates.select { |_associate| _associate.dependent_names.include?(associate.name) }
        depending.each do |_associate|
          send(_associate.name).send("#{associate.name}=", instance)
        end

        instance
      end
    end
Define associated model instance setter method

 @example

   @association.user = User.new

 @param associate [Item]