Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3 table lock

Is it possible to lock database table. MySQL Example:

LOCK TABLES users WRITE

..using some native ActiveRecord methods?

like image 788
thesis Avatar asked Jan 28 '11 08:01

thesis


1 Answers

This is not supported by ActiveRecord, you will have to run it manually with:

ActiveRecord::Base.connection.execute("LOCK TABLE users WRITE")

You may want to check out this discussion at ruby-forum.com for some more info.

like image 149
Kamil Sarna Avatar answered Sep 18 '22 23:09

Kamil Sarna