Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Allow database specific locking clauses to be used

#6399

AR docs say that you can use a custom locking clause like so:

Product.find(1, :lock => 'LOCK IN SHARE MODE')
 # select * from products where id=1 LOCK IN SHARE MODE
 # https://github.com/rails/rails/blob/master/activerecord/lib/active_record/locking/pessimistic.rb#L11-12

But currently arel always uses 'FOR UPDATE' (https://github.com/rails/arel/blob/master/lib/arel/visitors/mysql.r....

This pull request for arel fixes the bug: https://github.com/rails/arel/pull/21

Wanted to make sure this makes it in for the 3.0.5 release.

Reported by Jesse Storimer · February 9th, 2011 @ 04:03 PM

State: resolved
Milestone: 3.0.5
Assigned to: Aaron Patterson Aaron Patterson
Importance: Low

Activity

  1. Aaron Patterson
    Aaron Patterson
    • State changed from new to resolved
    • Milestone set to 3.0.5
    • Importance changed from to Low

    Thanks. I've pulled this in to Arel, and the fixes should be released with arel 2.0.9. You can find the tests to ensure custom locks work here:

    https://github.com/rails/rails/commit/b3fcabb3a529e8ea3d2d6326b2d99...

    February 22nd, 2011 @ 12:15 AM