DavyJonesLocker / postgres_ext-serializers

MIT License
324 stars 30 forks source link

Don't ignore arel bind values in filter query #44

Closed felixbuenemann closed 8 years ago

felixbuenemann commented 8 years ago

This fixes missing bind values when conditions are on the arel select manager, for example join conditions. This is only used for AR 4.1+ because in AR 4.0 the arel has no bind_values.

It's possible that an additional fix is required for AR 4.0 if it does not store all bind values in relation.bind_values, we could probably add a test to check this case on all AR versions.

TODO:

felixbuenemann commented 8 years ago

It turns out neither AR 4.0 nor 4.1 use prepared statements for these types of queries. AR 4.0 requires a small fix to avoid ambiguous column in joins, because it does not expand symbols in select() to fully qualified column names, which can be fixed by selecting the attribute from the arel table instead.