Flowdock
method

configure_dependency_for_belongs_to

Importance_0
Ruby on Rails latest stable (v4.0.2) - 0 notes - Class: ActiveRecord::Associations::ClassMethods

Method deprecated or moved

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

configure_dependency_for_belongs_to(reflection) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/associations.rb, line 1689
        def configure_dependency_for_belongs_to(reflection)
          if reflection.options.include?(:dependent)
            name = reflection.options[:dependent]

            unless [:destroy, :delete].include?(name)
              raise ArgumentError, "The :dependent option expects either :destroy or :delete (#{reflection.options[:dependent].inspect})"
            end

            method_name = :"belongs_to_dependent_#{name}_for_#{reflection.name}"
            class_eval               def #{method_name}                association = #{reflection.name}                association.#{name} if association              end, __FILE__, __LINE__ + 1
            after_destroy method_name
          end
        end
Register or log in to add new notes.