instance method add_association_callbacks

Ruby on Rails 2.3.18

Since v2.2.3 Last seen in v3.0.20 Private

Available in: v2.2.3 v2.3.18 v3.0.20

Signature

add_association_callbacks(association_name, options)

No documentation comment.

Parameters

association_name req
options req
Source
# File activerecord/lib/active_record/associations.rb, line 1793
        def add_association_callbacks(association_name, options)
          callbacks = %w(before_add after_add before_remove after_remove)
          callbacks.each do |callback_name|
            full_callback_name = "#{callback_name}_for_#{association_name}"
            defined_callbacks = options[callback_name.to_sym]
            if options.has_key?(callback_name.to_sym)
              class_inheritable_reader full_callback_name.to_sym
              write_inheritable_attribute(full_callback_name.to_sym, [defined_callbacks].flatten)
            else
              write_inheritable_attribute(full_callback_name.to_sym, [])
            end
          end
        end

Defined in activerecord/lib/active_record/associations.rb line 1793 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Associations::ClassMethods

Type at least 2 characters to search.

↑↓ navigate · open · esc close