method

configure_dependency

rails latest stable - Class: ActiveRecord::Associations::Builder::Association

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v4.0.2) is shown here.

configure_dependency()
public

No documentation available.

# File activerecord/lib/active_record/associations/builder/association.rb, line 83
    def configure_dependency
      unless valid_dependent_options.include? options[:dependent]
        raise ArgumentError, "The :dependent option must be one of #{valid_dependent_options}, but is :#{options[:dependent]}"
      end

      if options[:dependent] == :restrict
        ActiveSupport::Deprecation.warn(
          "The :restrict option is deprecated. Please use :restrict_with_exception instead, which "            "provides the same functionality."
        )
      end

      mixin.class_eval         def #{macro}_dependent_for_#{name}          association(:#{name}).handle_dependency        end, __FILE__, __LINE__ + 1

      model.before_destroy "#{macro}_dependent_for_#{name}"
    end