Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Extended by:
PGArrays::ReferencesBy::ClassMethods
Defined in:
lib/ar_pg_array/querying.rb

Class Method Summary collapse

Methods included from PGArrays::ReferencesBy::ClassMethods

references_by_array

Class Method Details

.attribute_condition_with_postgresql_arrays(quoted_column_name, argument) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/ar_pg_array/querying.rb', line 4

def attribute_condition_with_postgresql_arrays(quoted_column_name, argument)
  if ::PGArrays::PgArray === argument
    case argument
      when ::PGArrays::PgAny then      "#{quoted_column_name} && ?"
      when ::PGArrays::PgAll then      "#{quoted_column_name} @> ?"
      when ::PGArrays::PgIncludes then "#{quoted_column_name} <@ ?"
      else "#{quoted_column_name} = ?"
    end
  else
    attribute_condition_without_postgresql_arrays(quoted_column_name, argument)
  end
end

.quote_bound_value_with_postgresql_arrays(value) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/ar_pg_array/querying.rb', line 18

def quote_bound_value_with_postgresql_arrays(value)
  if ::PGArrays::PgArray === value
    connection.quote_array_by_base_type(value, value.base_type)
  else
    quote_bound_value_without_postgresql_arrays(value)
  end
end