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