Class: Tutuf::VisualQuery::Common
- Inherits:
-
Object
- Object
- Tutuf::VisualQuery::Common
- Defined in:
- lib/tutuf/visual_query/common.rb
Class Method Summary collapse
- .connection ⇒ Object
-
.quote_ident(str) ⇒ Object
delegates to PostgreSQL raw connection.
- .quote_relation_name(name) ⇒ Object
Instance Method Summary collapse
-
#filters_to_a(&block) ⇒ Object
Parameters of the block:
schema,relation_name,column_name,operator,value.
Class Method Details
.connection ⇒ Object
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 |