Method: Zena::Use::QueryNode::Compiler#resolve_missing_table

Defined in:
lib/zena/use/query_node.rb

#resolve_missing_table(query, table_name, table_alias) ⇒ Object

This is used to avoid finding random indexed objects or links in clauses with and without link filters like this: “image or icon” (‘image’ is a filter in ‘parent’ scope, ‘icon’ is a relation found through links).



539
540
541
542
543
544
545
546
547
548
549
550
# File 'lib/zena/use/query_node.rb', line 539

def resolve_missing_table(query, table_name, table_alias)
  if table_name =~ /^idx_nodes/
    # index tables
    query.where.insert 0, "#{table_alias}.node_id = 0"
  elsif table_name == 'links' || table_name =~ /^idx_/
    # index tables
    query.where.insert 0, "#{table_alias}.id = 0"
  else
    # Raise an error
    super
  end
end