lib/sequel/plugins/many_through_many.rb in sequel-4.43.0 vs lib/sequel/plugins/many_through_many.rb in sequel-4.44.0

- old
+ new

@@ -79,11 +79,11 @@ # # Make the Album class support many_through_many associations # Album.plugin :many_through_many module ManyThroughMany # The AssociationReflection subclass for many_through_many associations. class ManyThroughManyAssociationReflection < Sequel::Model::Associations::ManyToManyAssociationReflection - Sequel::Model::Associations::ASSOCIATION_TYPES[:many_through_many] = self + Sequel.synchronize{Sequel::Model::Associations::ASSOCIATION_TYPES[:many_through_many] = self} # many_through_many and one_through_many associations can be clones def cloneable?(ref) ref[:type] == :many_through_many || ref[:type] == :one_through_many end @@ -100,10 +100,21 @@ cached_fetch(:#{meth}){calculate_edges[:#{meth}]} end END end + 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 + def finalize_settings + FINALIZE_SETTINGS + end + # The alias for the first join table. def join_table_alias final_reverse_edge[:alias] end @@ -179,10 +190,10 @@ Array(qualify(fe[:table], fe[:right])) + Array(qualify(associated_class.table_name, associated_class.primary_key)) end end class OneThroughManyAssociationReflection < ManyThroughManyAssociationReflection - Sequel::Model::Associations::ASSOCIATION_TYPES[:one_through_many] = self + Sequel.synchronize{Sequel::Model::Associations::ASSOCIATION_TYPES[:one_through_many] = self} include Sequel::Model::Associations::SingularAssociationReflection end module ClassMethods # Create a many_through_many association. Arguments: