Module: Arel::TreeManager::StatementMethods

Included in:
DeleteManager, UpdateManager
Defined in:
activerecord/lib/arel/tree_manager.rb

Instance Method Summary collapse

Instance Method Details

#keyObject



31
32
33
# File 'activerecord/lib/arel/tree_manager.rb', line 31

def key
  @ast.key
end

#key=(key) ⇒ Object



23
24
25
26
27
28
29
# File 'activerecord/lib/arel/tree_manager.rb', line 23

def key=(key)
  @ast.key = if key.is_a?(Array)
    key.map { |k| Nodes.build_quoted(k) }
  else
    Nodes.build_quoted(key)
  end
end

#offset(offset) ⇒ Object



13
14
15
16
# File 'activerecord/lib/arel/tree_manager.rb', line 13

def offset(offset)
  @ast.offset = Nodes::Offset.new(Nodes.build_quoted(offset)) if offset
  self
end

#order(*expr) ⇒ Object



18
19
20
21
# File 'activerecord/lib/arel/tree_manager.rb', line 18

def order(*expr)
  @ast.orders = expr
  self
end

#take(limit) ⇒ Object



8
9
10
11
# File 'activerecord/lib/arel/tree_manager.rb', line 8

def take(limit)
  @ast.limit = Nodes::Limit.new(Nodes.build_quoted(limit)) if limit
  self
end

#where(expr) ⇒ Object



39
40
41
42
# File 'activerecord/lib/arel/tree_manager.rb', line 39

def where(expr)
  @ast.wheres << expr
  self
end

#wheres=(exprs) ⇒ Object



35
36
37
# File 'activerecord/lib/arel/tree_manager.rb', line 35

def wheres=(exprs)
  @ast.wheres = exprs
end