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’)

Regards,

On May 19, 6:51 am, Venkat E. [email protected]
wrote:

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

There’s nothing built into rails as far as table locks go, so there’s
not much more that you can do than that (apart I suppose from wrapping
things up nicely so that you can’t forget to unlock tables).

Fred

On Mon, May 18, 2009 at 10:51 PM, Venkat E. <
[email protected]> wrote:

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
following:

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,

-Conrad