Lock Table : Help me to write an alternative code in RoR

Please help me to write an alternative code for below in ROR…

ActiveRecord::Base.connection.execute(“LOCK TABLES table_name WRITE”)

ActiveRecord::Base.connection.execute(‘UNLOCK TABLES’)

Venkat, what are you trying to do exactly? It seems that you’re trying to do the


a) lock the table

b) do some db modifications

c) unlock the table

If this is the case, I would recommend reading up on the transaction support within RoR. If this doesn’t do the job for you, you may consider wrapping these methods in before and after filters respectively at the controller or model level.

Good luck,