HomePhorge

Fix ActiveRecord handling of symbols in query interpolation.
670d30c245dbUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

Fix ActiveRecord handling of symbols in query interpolation.

Most versions of ActiveRecord, including the ones I test with, treat an
interpolated symbol in an SQL query as a simple string, vis:

["example = ?", :banana] => "... WHERE example = 'banana' ..."

Some versions, though, preserve the symbol-nature, and instead:

["example = ?", :banana] => "... WHERE example = ':banana' ..."
# ...or some variant of that, where it isn't just the string.

So, to avoid this confusion, manually stringify the symbol name of our
resource type in the query builder. This gives consistent and expected
behaviour at all times.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>

Details

Provenance
Daniel Pittman <daniel@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUa04051a48c24: (#9051) Move complex collect expression error into terminus.
Branches
Unknown
Tags
Unknown

Event Timeline

Daniel Pittman <daniel@puppetlabs.com> committed rPU670d30c245db: Fix ActiveRecord handling of symbols in query interpolation. (authored by Daniel Pittman <daniel@puppetlabs.com>).Sep 9 2011, 1:45 AM