Method: Arel::SelectManager#lock

Defined in:
activerecord/lib/arel/select_manager.rb

#lock(locking = Arel.sql("FOR UPDATE")) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
# File 'activerecord/lib/arel/select_manager.rb', line 52

def lock(locking = Arel.sql("FOR UPDATE"))
  case locking
  when true
    locking = Arel.sql("FOR UPDATE")
  when Arel::Nodes::SqlLiteral
  when String
    locking = Arel.sql locking
  end

  @ast.lock = Nodes::Lock.new(locking)
  self
end