Posted almost 10 years ago. Visible to the public. Repeats.

Writing raw SQL queries

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 Archive are available: select_value, select_rows, of update being the most usual.

Owner of this card:

Julien Letessier
Last edit:
over 4 years ago
Posted by Julien Letessier to HouseTrip Deck
This website uses short-lived cookies to improve usability.
Accept or learn more