method
configure_dependency_for_belongs_to
configure_dependency_for_belongs_to(reflection)
private
Hide source
# File activerecord/lib/active_record/associations.rb, line 1701 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}""belongs_to_dependent_#{name}_for_#{reflection.name}" class_eval "def \#{method_name}\nassociation = \#{reflection.name}\nassociation.\#{name} if association\nend\n", __FILE__, __LINE__ + 1 after_destroy method_name end end