diff options
Diffstat (limited to 'lib/arel/select_manager.rb')
-rw-r--r-- | lib/arel/select_manager.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb index 249ad680a7..adffcca764 100644 --- a/lib/arel/select_manager.rb +++ b/lib/arel/select_manager.rb @@ -37,9 +37,15 @@ module Arel @ctx.wheres.map { |c| to_sql.accept c } end - def lock locking = true - # FIXME: do we even need to store this? If locking is +false+ shouldn't - # we just remove the node from the AST? + 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 |