Method: Sequel::Plugins::PgArrayAssociations::PgArrayToManyAssociationReflection#can_have_associated_objects?

Defined in:
lib/sequel/plugins/pg_array_associations.rb

#can_have_associated_objects?(obj) ⇒ Boolean

pg_array_to_many associations can only have associated objects if the array field is not nil or empty.

Returns:

  • (Boolean)


206
207
208
209
# File 'lib/sequel/plugins/pg_array_associations.rb', line 206

def can_have_associated_objects?(obj)
  v = obj.get_column_value(self[:key])
  v && !v.empty?
end