On Sun, Jan 01, 2012 at 09:48:27PM -0500, Ken Collins wrote: > > I could not find the answer to this in a few Google searches and thought I > would ask. > > So when are prepared statements best leveraged in ActiveRecord's interface? I > never really noticed before, but simple condition hashes or scopes do not > pass down the binds so that prepared statements are leveraged. So a > `Car.find(1)` would but things like `Car.where(:id => 1).first` do not. Is it > a WIP to to make this happen or blessed interfaces that help?
Hi Ken, You're correct. Right now only code like `Car.find(1)` will create a bound parameter. I don't think we should make any high level interfaces for distinguishing between prepared and non-prepared statements. In other words, we should make it transparent, automatic, and backwards compatible. I have plans for supporting hash based arguments (since we can determine the columns), I just haven't implemented it yet. Patches welcome. ;-) -- Aaron Patterson http://tenderlovemaking.com/
pgpTujoHlmtaj.pgp
Description: PGP signature
