Class: Sequel::Plugins::ManyThroughMany::ManyThroughManyAssociationReflection

Inherits:
Model::Associations::ManyToManyAssociationReflection show all
Defined in:
lib/sequel/plugins/many_through_many.rb

Overview

The AssociationReflection subclass for many_through_many associations.

Direct Known Subclasses

OneThroughManyAssociationReflection

Constant Summary collapse

FINALIZE_SETTINGS =
superclass::FINALIZE_SETTINGS.merge(
  :associated_key_table=>:associated_key_table,
  :edges=>:edges,
  :final_edge=>:final_edge,
  :final_reverse_edge=>:final_reverse_edge,
  :reverse_edges=>:reverse_edges
).freeze

Constants inherited from Model::Associations::AssociationReflection

Model::Associations::AssociationReflection::ASSOCIATION_DATASET_PROC

Instance Method Summary collapse

Methods inherited from Model::Associations::ManyToManyAssociationReflection

#associated_key_alias, #associated_key_array, #associated_key_column, #associated_object_keys, #can_have_associated_objects?, #default_eager_loader, #default_join_table, #default_left_key, #default_right_key, #eager_loading_use_associated_key?, #join_table_source, #need_associated_primary_key?, #predicate_key, #qualified_right_key, #qualified_right_primary_key, #right_primary_key, #right_primary_key_method, #right_primary_key_methods, #right_primary_keys, #select

Methods inherited from Model::Associations::AssociationReflection

#_add_method, #_remove_all_method, #_remove_method, #_setter_method, #add_method, #apply_dataset_changes, #apply_distinct_on_eager_limit_strategy, #apply_eager_dataset_changes, #apply_eager_graph_limit_strategy, #apply_eager_limit_strategy, #apply_ruby_eager_limit_strategy, #apply_window_function_eager_limit_strategy, #assign_singular?, #associated_class, #associated_dataset, #association_dataset_for, #association_dataset_proc, #association_method, #can_have_associated_objects?, #dataset_method, #dataset_need_primary_key?, #delete_row_number_column, #eager_graph_lazy_dataset?, #eager_graph_limit_strategy, #eager_limit_strategy, #eager_load_results, #eager_loader_key, #eager_loading_use_associated_key?, #filter_by_associations_add_conditions?, #filter_by_associations_conditions_expression, #finalize, #handle_silent_modification_failure?, #initialize_association_cache, #inspect, #limit_and_offset, #need_associated_primary_key?, #placeholder_loader, #predicate_key_values, #predicate_keys, #qualify, #qualify_assoc, #qualify_cur, #reciprocal_array?, #remove_all_method, #remove_before_destroy?, #remove_method, #remove_should_check_existing?, #returns_array?, #select, #set_reciprocal_to_self?, #setter_method, #slice_range

Methods included from Inflections

clear, irregular, plural, singular, uncountable

Methods inherited from Hash

#&, #case, #hstore, #pg_json, #pg_jsonb, #sql_expr, #sql_negate, #sql_or, #|, #~

Instance Method Details

#cloneable?(ref) ⇒ Boolean

many_through_many and one_through_many associations can be clones

Returns:

  • (Boolean)

87
88
89
# File 'lib/sequel/plugins/many_through_many.rb', line 87

def cloneable?(ref)
  ref[:type] == :many_through_many || ref[:type] == :one_through_many
end

#default_associated_key_aliasObject

The default associated key alias(es) to use when eager loading associations via eager.


93
94
95
# File 'lib/sequel/plugins/many_through_many.rb', line 93

def default_associated_key_alias
  self[:uses_left_composite_keys] ? (0...self[:through].first[:left].length).map{|i| :"x_foreign_key_#{i}_x"} : :x_foreign_key_x
end

#finalize_settingsObject


112
113
114
# File 'lib/sequel/plugins/many_through_many.rb', line 112

def finalize_settings
  FINALIZE_SETTINGS
end

#join_table_aliasObject

The alias for the first join table.


117
118
119
# File 'lib/sequel/plugins/many_through_many.rb', line 117

def join_table_alias
  final_reverse_edge[:alias]
end

#reciprocalObject

Many through many associations don't have a reciprocal


122
123
124
# File 'lib/sequel/plugins/many_through_many.rb', line 122

def reciprocal
  nil
end