Method: Zena::Use::QueryNode::Compiler#scope_fields

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

#scope_fields(scope) ⇒ Object

Scope current context with previous context. For example:

                        current         previous
['parent_id', 'id'] ==> no1.parent_id = nodes.id


148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/zena/use/query_node.rb', line 148

def scope_fields(scope)
  case scope
  when 'self'
    ['parent_id', 'id']
  when *CORE_CONTEXTS
    last? ? %W{#{scope}_id #{scope}_id} : %W{#{scope}_id id}
  when 'site', main_table
    # not an error, but do not scope
    []
  else
    #if CORE_CONTEXTS.include?(scope)
    # error
    nil
  end
end