Duane J. wrote:
When I specify the fields for searches_on, the query log shows the
additional query:SELECT * FROM foobar WHERE ((UCASE(title) LIKE ‘%SEARCHSTRING%’ OR
UCASE(name) LIKE ‘%SEARCHSTRING%’ OR UCASE(blah) LIKE
‘%SEARCHSTRING%’Is it causing an error because of the lack of closing parens?
Sorry, the lack of closing parens in the above query was my fault from
when I was trying to sanitize the query before posting to the public.
When the error occurs, MySQL does not even see the above search query.
It only receives the SHOW FIELDS query. The above query is received when
I specify the columns for searches_on (eg. ‘searches_on :title :name
:blah’ vs. ‘searches_on :all’)
Just to make sure we’re on the same page, I’ve attached the latest
search.rb file that I have. I think it’s slightly different from the
one you’re using, because the error wasn’t on the same line. Could
you check this one?
OK. I’m using this new ‘search.rb’, but still get an error.
My model has:
require_dependency “search”
class Foobar < ActiveRecord::Base
end
Here is the error:
NoMethodError in Foobar#search
undefined method `validate_options’ for Foobar:Class
RAILS_ROOT: ./script/…/config/…
Application Trace | Framework Trace | Full Trace
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/bas
e.rb:991:in method_missing' #{RAILS_ROOT}/lib/search.rb:50:in
search’
#{RAILS_ROOT}/app/controllers/foobar_controller.rb:58:in `search’
The error is the same with or without ‘searches_on :all’ in the model
file.
Where do you have ‘validate_options’ defined?
Thanks Duane.
Matt
–
Matt C. Wagner
Information Security Analyst
Network Intrusion Detection
Security Operations Center
Corporate Information Security
Wells Fargo Bank