how do I make a direct SQL call (e.g. LOCK TABLES)?


I’m stuck. I can’t quite see in Rails how to make a direct database call (e.g. LOCK TABLES…), and leverage the rails connection framework?

How do you do this? I see the “execute” command in ActiveRecord::ConnectionAdapters::DatabaseStatements doesn’t seem to work.


You can call:

  Mymodel.connection.execute("LOCK TABLES...")

with whatever SQL you need...


Greg Hauptmann wrote: