
undefined method `new_search'
Reported by Timobx | December 3rd, 2008 @ 06:01 PM
Hi,
I am trying your example word for word because it would be useful to my project. However, I am getting this error message:
undefined method `new_search' for #Class:0x47eb3d8
Full Trace says:
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1532:in
method_missing'
app/controllers/users_controller.rb:3:in
index'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in
send'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in
perform_action_without_filters'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in
call_filters'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in
perform_action_without_benchmark'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue'
C:/rubyinst/ruby/lib/ruby/1.8/benchmark.rb:293:in
measure'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in
perform_action_without_caching'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in
perform_action'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in
cache'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in
cache'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in
perform_action'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in
send'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in
process_without_filters'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in
process_without_session_management_support'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in
process'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in
process'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in
handle_request'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in
dispatch'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in
dispatch_cgi'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in
dispatch'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/rails.rb:76:in
process'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/rails.rb:74:in
synchronize'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/rails.rb:74:in
process'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:159:in
process_client'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:158:in
each'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:158:in
process_client'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:285:in
run'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:285:in
initialize'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:285:in
new'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:285:in
run'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:268:in
initialize'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:268:in
new'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:268:in
run'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/configurator.rb:282:in
run'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/configurator.rb:281:in
each'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/configurator.rb:281:in
run'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/mongrel_rails:128:in
run'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/command.rb:212:in
run'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/mongrel_rails:281
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
load'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
load'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
new_constants_in'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
load'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/mongrel.rb:64
C:/rubyinst/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require'
C:/rubyinst/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in
require'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
new_constants_in'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in
require'
C:/rubyinst/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39
C:/rubyinst/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require'
C:/rubyinst/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require'
script/server:3
I have spent a couple of days trying to debug but so far no luck. Any help is appreciated
Thanks
Tim
Comments and changes to this ticket
-
Ben Johnson December 3rd, 2008 @ 06:02 PM
- State changed from new to open
Can you give the contents of your controller action that is causing this?
-
Ben Johnson December 3rd, 2008 @ 06:20 PM
Well searchlogic doesnt create files or change anything permanently, obviously. Something is really strange about your problem. I know hundreds of people are using this without any problems. What version of rails are you running? Do you have a lot of other unusual plugins installed that may be conflicting?
-
Ben Johnson December 3rd, 2008 @ 06:29 PM
Yeah rails 2.0.X has some gem dependency issues. Try removing the gem line and installing it as a plugin.
-
Ben Johnson December 3rd, 2008 @ 06:45 PM
Ha ha, well the plugin is definitely there. Can you download it as a zip and install the plugin manually? This does seem strange though.
-
Ben Johnson December 3rd, 2008 @ 06:52 PM
I don't believe so, you are the first person I have heard of having issues like this. Searchlogic should work just fine on rails 2.0.X
-
Ben Johnson December 3rd, 2008 @ 06:58 PM
I really don't think its searchlogic, the only thing i can do is help you out over a better means of communication, like AIM.
-
Ben Johnson December 5th, 2008 @ 01:55 PM
What do you mean, it can easily query multiple fields:
search = User.new_search search.conditions.first_name_ends_with = "Ben" search.conditions.last_name_starts_with = "Whatever" search.all
-
Ben Johnson December 5th, 2008 @ 02:17 PM
Yeah, it really depends on how you are doing it. In my controller I have done something like:
search = User.new_search(params[:search]) search.conditions.last_name_like = search.conditions.email_like = search.conditions.first_name_like search.all
So you only have the first_name_like field in your form and them force assign the other fields that use the same value.
-
Ben Johnson December 5th, 2008 @ 05:29 PM
Yeah, you have to do it off of your search object, which is probably @search
-
Ben Johnson December 5th, 2008 @ 05:45 PM
Yeah the successive searches need to have an @ in front of them
-
-
Ben Johnson December 5th, 2008 @ 07:46 PM
- State changed from open to resolved
Your view need to use the "like" condition the last field, which would be last_name. Keywords and like are different, keywords cleans up the search, like does an exact search for that string. So your view field needs to reflect what you are doing in your controller.
-
Ben Johnson December 12th, 2008 @ 12:57 AM
Can you look in your logs and see what query it is executing? That is the best way to see what is going on behind the scenes. If you can look at the raw query it should be pretty easy to determine what the problem is.
-
Ben Johnson December 12th, 2008 @ 03:59 PM
Either do:
@search.any = true
or
@search.conditions_or_first_name_like
etc.., prefix the condition with or or and and it will join it appropriately
-
Ben Johnson December 15th, 2008 @ 01:02 PM
Sorry, made a typo:
@search.conditions.any = true
or
@search.conditions.or_first_name_like
-
Ben Johnson December 15th, 2008 @ 01:34 PM
No problem, the documentation covers all of this. If it is a useful tool for you it might be worth spending the time to read through the readme. For example, I love HAML, but I had to spend about 15 minutes reading through the docs, making a cheat sheet, etc, until I was used to using it. It helped a lot.
-
xijo (at gmx) November 3rd, 2009 @ 10:38 AM
@search.conditions.any = true or @search.conditions.or_first_name_like
Hi there and sorry for burrowing old things, but is something like the quoted possible in SL2? Thanks and best regards, Joe
-
-
-
-
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Provides common named scopes and object based searching.