mercredi 29 août 2018

How to access raw SQL statement generated by update_all (ActiveRecord method)

I'm just wondering if there's a way to access the raw SQL that's executed for an update_all ActiveRecord request. As an example, take the simple example below:

Something.update_all( ["to_update = ?"], ["id = ?" my_id] )

In the rails console I can see the raw SQL statement so I'm guessing it's available for me to access in some way?

PS - I'm specifically interested in update_all and can't change it to anything else.

Thanks!

Aucun commentaire:

Enregistrer un commentaire