Class: EacRailsUtils::Models::TablelessAssociations::HasManyForActiveModel

Inherits:
ActiveRecord::Associations::Builder::HasMany
  • Object
show all
Defined in:
lib/eac_rails_utils/models/tableless_associations/has_many_for_active_model.rb

Constant Summary collapse

AR_CALLBACK_METHODS =
i[define_callback before_validation after_validation before_save
after_save before_update after_update].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.define_callbacks(model, reflection) ⇒ Object



18
19
20
21
22
# File 'lib/eac_rails_utils/models/tableless_associations/has_many_for_active_model.rb', line 18

def self.define_callbacks(model, reflection)
  return unless AR_CALLBACK_METHODS.all? { |meth| respond_to?(meth) }

  super
end

.valid_options(_options) ⇒ Object



13
14
15
16
# File 'lib/eac_rails_utils/models/tableless_associations/has_many_for_active_model.rb', line 13

def self.valid_options(_options)
  super + i[active_model
             target_ids] - i[through dependent source source_type counter_cache as]
end

Instance Method Details

#valid_optionsObject



24
25
26
27
# File 'lib/eac_rails_utils/models/tableless_associations/has_many_for_active_model.rb', line 24

def valid_options
  super + i[active_model
             target_ids] - i[through dependent source source_type counter_cache as]
end