Class: Tutuf::VisualQuery::Common

Inherits:
Object
  • Object
show all
Defined in:
lib/tutuf/visual_query/common.rb

Direct Known Subclasses

Base, Single, Sql

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.connectionObject



6
7
8
# File 'lib/tutuf/visual_query/common.rb', line 6

def connection
  ActiveRecord::Base.connection
end

.quote_ident(str) ⇒ Object

delegates to PostgreSQL raw connection



11
12
13
# File 'lib/tutuf/visual_query/common.rb', line 11

def quote_ident(str)
  connection.raw_connection.quote_ident(str)
end

.quote_relation_name(name) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/tutuf/visual_query/common.rb', line 15

def quote_relation_name(name)
  if String === name # in default schema
    quote_ident(name)
  elsif Hash === name
    "#{!name['schema'].blank? ? quote_ident(name['schema']) + '.' : ''}#{quote_ident(name['rel_name'])}"
  end
end

Instance Method Details

#filters_to_a(&block) ⇒ Object

Parameters of the block: schema, relation_name, column_name, operator, value



25
26
27
# File 'lib/tutuf/visual_query/common.rb', line 25

def filters_to_a(&block)
  parse_filters(filters, &block)
end