ernie/squeel — Issue #72: Huge problems generating desired query
Author: gucki
Created: 2011-10-27 16:07:46+00:00
State: open

Sorry to bother you with this, but I simply cannot find a solution to make squeel generate my desired query. Here's my code with all the scopes I tried and the exception I got (I used only one at once).

class Offer < ActiveRecord::Base
def build_scope
brands = [1,2,3]
modelss = [4,5,6]
scope = scoped
scope = scope.where{(id.in brands) | (id.in modells)} # undefined method `in' for 0:Fixnum
scope = scope.where{(:id.in brands) | (:id.in modells)} # undefined method `in' for :id:Symbol
scope = scope.where{("id".in brands) | ("id".in modells)} # undefined method `in' for "id":String
scope = scope.where{{:id => brands} | {:id => modells}} # Cannot visit Sequel::SQL::BooleanExpression
end
end

Any help would be really nice :)