class Sequel::Plugins::PgArrayAssociations::ManyToPgArrayAssociationReflection

  1. lib/sequel/plugins/pg_array_associations.rb
Superclass: Sequel::Model::Associations::AssociationReflection

The AssociationReflection subclass for many_to_pg_array associations.

Constants

FINALIZE_SETTINGS = superclass::FINALIZE_SETTINGS.merge( :array_type=>:array_type ).freeze  

Public Instance methods

array_type()
[show source]
   # File lib/sequel/plugins/pg_array_associations.rb
80 def array_type
81   cached_fetch(:array_type) do
82     if (sch = associated_class.db_schema) && (s = sch[self[:key]]) && (t = s[:db_type])
83       t.sub(/\[\]\z/, '').freeze
84     else
85       :integer
86     end
87   end
88 end
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
92 def associated_object_keys
93   [self[:key]]
94 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
 98 def can_have_associated_objects?(obj)
 99   obj.get_column_value(self[:primary_key])
100 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
104 def default_key
105   :"#{underscore(demodulize(self[:model].name))}_ids"
106 end
eager_graph_limit_strategy(_)

Always use the ruby eager_graph limit strategy if association is limited.

[show source]
    # File lib/sequel/plugins/pg_array_associations.rb
109 def eager_graph_limit_strategy(_)
110   :ruby if self[:limit]
111 end
eager_limit_strategy()

Always use the ruby eager limit strategy

[show source]
    # File lib/sequel/plugins/pg_array_associations.rb
114 def eager_limit_strategy
115   cached_fetch(:_eager_limit_strategy) do
116     :ruby if self[:limit]
117   end
118 end
filter_by_associations_limit_strategy()

Don’t use a filter by associations limit strategy

[show source]
    # File lib/sequel/plugins/pg_array_associations.rb
121 def filter_by_associations_limit_strategy
122   nil
123 end
finalize_settings()
[show source]
    # File lib/sequel/plugins/pg_array_associations.rb
128 def finalize_settings
129   FINALIZE_SETTINGS
130 end
handle_silent_modification_failure?()

Handle silent failure of add/remove methods if raise_on_save_failure is false.

[show source]
    # File lib/sequel/plugins/pg_array_associations.rb
133 def handle_silent_modification_failure?
134   self[:raise_on_save_failure] == false
135 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
138 def predicate_key
139   cached_fetch(:predicate_key){qualify_assoc(self[:key_column])}
140 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
144 def primary_key
145   self[:primary_key]
146 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
150 def remove_before_destroy?
151   false
152 end