This may work in Ruby 1.9+, but fails in 1.8.7 (with Rails 2.3.18).
Example
class Foo
has_and_belongs_to_many :bars
end
class Bar
has_and_belongs_to_many :foos
end
Foo.bars_id_in(2) # fails
I worked around this by monkey patching:
module Searchlogic
module NamedScopes
module ColumnConditions
# In SearchLogic 2.5.9+, this was changed to respond_to_missing?
# which breaks Foo.bar_id_equals_any(...) where Foo habtm Bar
def respond_to?(*args)
super || (self != ::ActiveRecord::Base && !self.abstract_class? && !create_condition(args.first).blank?)
end
end
end
end
In SearchLogic 2.5.9 or greater, HABTM relationship queries fail with "undefined method" errors.
The cause of this is the change from
respond_to?
torespond_to_missing?
in https://github.com/binarylogic/searchlogic/commit/16e7e2605a605dc39d8db0734f69dd9d1e1f1872.This may work in Ruby 1.9+, but fails in 1.8.7 (with Rails 2.3.18).
Example
I worked around this by monkey patching: