Class Sequel::Plugins::PgArrayAssociations::ManyToPgArrayAssociationReflection
In: lib/sequel/plugins/pg_array_associations.rb
Parent: Sequel::Model::Associations::AssociationReflection

The AssociationReflection subclass for many_to_pg_array associations.

Methods

Public Instance methods

The array column in the associated model containing foreign keys to the current model.

[Source]

    # File lib/sequel/plugins/pg_array_associations.rb, line 77
77:         def associated_object_keys
78:           [self[:key]]
79:         end

many_to_pg_array associations can have associated objects as long as they have a primary key.

[Source]

    # File lib/sequel/plugins/pg_array_associations.rb, line 83
83:         def can_have_associated_objects?(obj)
84:           obj.send(self[:primary_key])
85:         end

Assume that the key in the associated table uses a version of the current model‘s name suffixed with _ids.

[Source]

    # File lib/sequel/plugins/pg_array_associations.rb, line 89
89:         def default_key
90: 
91:           "#{underscore(demodulize(self[:model].name))}_ids"
92:         end

The hash key to use for the eager loading predicate (left side of IN (1, 2, 3))

[Source]

    # File lib/sequel/plugins/pg_array_associations.rb, line 94
94:         def predicate_key
95:           cached_fetch(:predicate_key){qualify_assoc(self[:key_column])}
96:         end

The column in the current table that the keys in the array column in the associated table reference.

[Source]

     # File lib/sequel/plugins/pg_array_associations.rb, line 100
100:         def primary_key
101:           self[:primary_key]
102:         end

Destroying the associated object automatically removes the association, since the association is stored in the associated object.

[Source]

     # File lib/sequel/plugins/pg_array_associations.rb, line 106
106:         def remove_before_destroy?
107:           false
108:         end

[Validate]