class Sequel::Plugins::PgArrayAssociations::ManyToPgArrayAssociationReflection

  1. lib/sequel/plugins/pg_array_associations.rb

The AssociationReflection subclass for many_to_pg_array associations.

Public Instance methods

associated_object_keys ()

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

[show source]
# File lib/sequel/plugins/pg_array_associations.rb, line 80
def associated_object_keys
  [self[:key]]
end
can_have_associated_objects? (obj)

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

[show source]
# File lib/sequel/plugins/pg_array_associations.rb, line 86
def can_have_associated_objects?(obj)
  obj.send(self[:primary_key])
end
default_key ()

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

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

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

[show source]
# File lib/sequel/plugins/pg_array_associations.rb, line 97
def predicate_key
  cached_fetch(:predicate_key){qualify_assoc(self[:key_column])}
end
primary_key ()

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

[show source]
# File lib/sequel/plugins/pg_array_associations.rb, line 103
def primary_key
  self[:primary_key]
end
remove_before_destroy? ()

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

[show source]
# File lib/sequel/plugins/pg_array_associations.rb, line 109
def remove_before_destroy?
  false
end