rails/rails — pull request #4479 by exviva (2012-01-16 13:12:47+00:00)
Title: Accept a block in pessimistic lock

This allows to shorten a typical idiom of calling the `lock!`
method as first within a transaction:

```ruby
class Order < ActiveRecord::Base
def cancel!
transaction do
lock!
# ... cancelling logic
end
end
end

# becomes:

class Order < ActiveRecord::Base
def cancel!
lock! do
# ... cancelling logic
end
end
end
```

If this patch gets accepted, I'll update the changelog and guides/docs, and create a separate PR for master.