mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
61401184e9
Stop running association callbacks when setting `has_many` inverse records. The `before_add` and `after_add` callbacks are meant for newly added records.
16 lines
568 B
Ruby
16 lines
568 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Interest < ActiveRecord::Base
|
|
belongs_to :man, inverse_of: :interests
|
|
belongs_to :man_with_callbacks,
|
|
class_name: "Man",
|
|
foreign_key: :man_id,
|
|
inverse_of: :interests_with_callbacks
|
|
belongs_to :polymorphic_man, polymorphic: true, inverse_of: :polymorphic_interests
|
|
belongs_to :polymorphic_man_with_callbacks,
|
|
foreign_key: :polymorphic_man_id,
|
|
foreign_type: :polymorphic_man_type,
|
|
polymorphic: true,
|
|
inverse_of: :polymorphic_interests_with_callbacks
|
|
belongs_to :zine, inverse_of: :interests
|
|
end
|