Class: ActiveRecord::Base

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PGArrays::ReferencesBy::ClassMethods

references_by_array

Class Method Details

.quote_bound_value_with_postgresql_arrays(value, c = connection) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/ar_jdbc_pg_array/querying.rb', line 4

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

Instance Method Details

#column_defaultsObject



36
37
38
39
40
41
42
43
44
# File 'lib/ar_jdbc_pg_array/schema_arel.rb', line 36

def column_defaults
  defaults = column_defaults_without_extradup
  if defaults.values.grep(Array).empty?
    alias column_defaults column_defaults_without_extradup
  else
    alias column_defaults column_defaults_with_extradup
  end
  column_defaults
end

#column_defaults_with_extradupObject



29
30
31
32
33
34
35
# File 'lib/ar_jdbc_pg_array/schema_arel.rb', line 29

def column_defaults_with_extradup
  res = {}
  column_defaults_without_extradup.each{|k, v|
    res[k] = Array === v ? v.dup : v
  }
  res
end

#column_defaults_without_extradupObject



28
# File 'lib/ar_jdbc_pg_array/schema_arel.rb', line 28

alias column_defaults_without_extradup column_defaults