The AssociationReflection subclass for pg_array_to_many associations.
Methods
Public Instance
Public Instance methods
associated_object_keys
()
An array containing the primary key for the associated model.
[show source]
# File lib/sequel/plugins/pg_array_associations.rb, line 140 def associated_object_keys Array(primary_key) end
can_have_associated_objects?
(obj)
pg_array_to_many associations can only have associated objects if the array field is not nil or empty.
[show source]
# File lib/sequel/plugins/pg_array_associations.rb, line 146 def can_have_associated_objects?(obj) v = obj.send(self[:key]) v && !v.empty? end
dataset_need_primary_key?
()
pg_array_to_many associations do not need a primary key.
[show source]
# File lib/sequel/plugins/pg_array_associations.rb, line 152 def dataset_need_primary_key? false end
default_key
()
Use a default key name of *_ids, for similarity to other association types that use *_id for single keys.
[show source]
# File lib/sequel/plugins/pg_array_associations.rb, line 158 def default_key :"#{singularize(self[:name])}_ids" end
filter_by_associations_conditions_expression
(obj)
[show source]
# File lib/sequel/plugins/pg_array_associations.rb, line 177 def filter_by_associations_conditions_expression(obj) ds = filter_by_associations_conditions_dataset.where(filter_by_associations_conditions_subquery_conditions(obj)) Sequel.function(:coalesce, Sequel.pg_array(filter_by_associations_conditions_key).overlaps(ds), Sequel::SQL::Constants::FALSE) end
predicate_key
()
A qualified version of the associated primary key.
[show source]
# File lib/sequel/plugins/pg_array_associations.rb, line 163 def predicate_key cached_fetch(:predicate_key){qualify_assoc(primary_key)} end
primary_key
()
The primary key of the associated model.
[show source]
# File lib/sequel/plugins/pg_array_associations.rb, line 168 def primary_key cached_fetch(:primary_key){associated_class.primary_key} end
primary_key_method
()
The method to call to get value of the primary key of the associated model.
[show source]
# File lib/sequel/plugins/pg_array_associations.rb, line 173 def primary_key_method cached_fetch(:primary_key_method){primary_key} end