Module: NestedSelect::Preloader::ThroughAssociation
- Defined in:
- lib/nested_select/preloader/through_association.rb
Instance Method Summary collapse
Instance Method Details
#reflection_relation_keys_attributes ⇒ Object
17 18 19 20 |
# File 'lib/nested_select/preloader/through_association.rb', line 17 def reflection_relation_keys_attributes foreign_key = reflection.foreign_key unless reflection.parent_reflection.is_a?(ActiveRecord::Reflection::HasAndBelongsToManyReflection) [*foreign_key, *reflection.klass.primary_key].map(&:to_s) end |
#through_preloaders ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/nested_select/preloader/through_association.rb', line 6 def through_preloaders @through_preloaders ||= ActiveRecord::Associations::Preloader.new( records: owners, associations: through_reflection.name, scope: through_scope, associate_by_default: false, ).tap do _1.apply_nested_select_values(nested_select_values&.grep(Hash)) end.loaders end |