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

[Source]

    # File lib/sequel/plugins/pg_array_associations.rb, line 78
78:         def array_type
79:           cached_fetch(:array_type) do
80:             if (sch = associated_class.db_schema) && (s = sch[self[:key]]) && (t = s[:db_type])
81:               t
82:             else
83:               :integer
84:             end
85:           end
86:         end

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

[Source]

    # File lib/sequel/plugins/pg_array_associations.rb, line 90
90:         def associated_object_keys
91:           [self[:key]]
92:         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 96
96:         def can_have_associated_objects?(obj)
97:           obj.get_column_value(self[:primary_key])
98:         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 102
102:         def default_key
103: 
104:           "#{underscore(demodulize(self[:model].name))}_ids"
105:         end

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

[Source]

     # File lib/sequel/plugins/pg_array_associations.rb, line 107
107:         def eager_graph_limit_strategy(_)
108:           :ruby if self[:limit]
109:         end

Always use the ruby eager limit strategy

[Source]

     # File lib/sequel/plugins/pg_array_associations.rb, line 112
112:         def eager_limit_strategy
113:           cached_fetch(:_eager_limit_strategy) do
114:             :ruby if self[:limit]
115:           end
116:         end

Don‘t use a filter by associations limit strategy

[Source]

     # File lib/sequel/plugins/pg_array_associations.rb, line 119
119:         def filter_by_associations_limit_strategy
120:           nil
121:         end

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

[Source]

     # File lib/sequel/plugins/pg_array_associations.rb, line 124
124:         def handle_silent_modification_failure?
125:           self[:raise_on_save_failure] == false
126:         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 129
129:         def predicate_key
130:           cached_fetch(:predicate_key){qualify_assoc(self[:key_column])}
131:         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 135
135:         def primary_key
136:           self[:primary_key]
137:         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 141
141:         def remove_before_destroy?
142:           false
143:         end

[Validate]