To edit pages or tickets please login with username/password: aaf/aaf

Ticket #143 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

Failiure to combine conditions with arrays

Reported by: aaf Assigned to: jk
Priority: major Milestone: 0.4.1
Component: 0plugin Version:
Keywords: Cc:

Description

Ferret currently seems to use method "combine_conditions" for combining user-specified conditions with those added by ferret. This is suboptimal, it not only duplicates the "with_scope" functionality of ActiveRecord? but also does not support arrays as bind variables because it flattens the conditions array and thus joins all arrays within it.

I'll attach a patch to the "demo" appliucation that contains a simple test to demonstrate the error and a patch that makes ferret use with_scope.

For the record, the error that happens when one uses arrays (that don't have exactly 1 items) for conditions with ferret looks like this:

ActiveRecord::PreparedStatementInvalid: wrong number of bind variables (3 for 2) in: comments.id in (?) and id IN (?)

Attachments

ferret_array_conditions_test.patch (0.5 kB) - added by aaf on 06/24/07 22:01:58.
ferret_use_with_scope.patch (2.8 kB) - added by aaf on 06/24/07 22:02:08.

Change History

06/24/07 22:01:58 changed by aaf

  • attachment ferret_array_conditions_test.patch added.

06/24/07 22:02:08 changed by aaf

  • attachment ferret_use_with_scope.patch added.

(follow-up: ↓ 2 ) 06/24/07 22:04:00 changed by aaf

btw. I used "send(:with_scope, " because I heard that with_scope is going to become protected soon and I'm unclear if it may or may not affect ferret's ability to call with_scope directly on models.

(in reply to: ↑ 1 ) 06/25/07 13:56:36 changed by jk

  • status changed from new to assigned.
  • milestone set to 0.4.1.

07/13/07 21:13:57 changed by jk

  • status changed from assigned to closed.
  • resolution set to fixed.

thanks for the patch!

To edit pages or tickets please login with username/password: aaf/aaf