You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In SearchLogic 2.5.9 or greater, HABTM relationship queries fail with "undefined method" errors.
undefined method `bar_id_equals_any' for #<Class:0x7febd2642d30>
/home/myapp/shared/bundle/ruby/1.8/gems/searchlogic-2.5.14/
lib/searchlogic/named_scopes/column_conditions.rb:81:in `method_missing'
The cause of this is the change from respond_to? to respond_to_missing? in 16e7e26.
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
The text was updated successfully, but these errors were encountered:
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 16e7e26.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:
The text was updated successfully, but these errors were encountered: