Writing raw SQL queries

Posted Over 11 years ago. Visible to the public. Repeats.

If you really, really have a good reason to write raw SQL (generally a bad practice), make sure you use the right call.

Avoid ActiveRecord::Base.connection.execute in general, in particular because Octopus relies on this to determine which queries go to replicas. execute would always go to the master.

A number of other methods Show archive.org snapshot are available: select_value, select_rows, of update being the most usual.

Julien Letessier
Last edit
About 6 years ago
Posted by Julien Letessier to HouseTrip Deck (2012-08-20 17:35)