#94 ✓resolved

nil object error

Reported by Josh | June 22nd, 2009 @ 02:31 AM

Hi, I used version 1 of SL and it worked great. Tried to follow directions for installing v2, and getting the following errors. Your help is greatly apreciated.

Rails v2.2.2

Only 1 model, no associations!

You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]

RAILS_ROOT: /home/josh/sites/jVilleCem
Application Trace | Framework Trace | Full Trace

vendor/rails/activerecord/lib/active_record/named_scope.rb:114:in initialize'<br/> vendor/rails/activerecord/lib/active_record/named_scope.rb:92:innew'
vendor/rails/activerecord/lib/active_record/named_scope.rb:92:in named_scope'<br/> vendor/rails/activerecord/lib/active_record/named_scope.rb:96:incall'
vendor/rails/activerecord/lib/active_record/named_scope.rb:96:in scoped'<br/> vendor/gems/binarylogic-searchlogic-2.0.1/lib/searchlogic/search.rb:85:inmethod_missing'
app/controllers/records_controller.rb:6:in index'

Controller code:

  @search = Record.search(params[:search])
  @records = @search.all

Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson June 24th, 2009 @ 02:08 AM

    • State changed from “new” to “open”

    What does your params[:search] hash look like?

  • Josh

    Josh June 24th, 2009 @ 02:24 AM

    Good evening Ben.

    params[:search] should be nil, this is on the first load of the page before any search has been submitted.

    Thanks for your help.


  • Josh

    Josh June 24th, 2009 @ 02:41 AM

    Oh and when I try from the console, I can create the search object without a problem. When I call s.all I get the same error as above.



  • Ben Johnson

    Ben Johnson July 6th, 2009 @ 12:29 AM

    Is there any way you can tell me how to recreate the problem. I can't do it for the life of me. I am using it just fine in a few apps of mine and everything I tried in the console worked fine.

  • Josh

    Josh July 7th, 2009 @ 02:08 AM

    Yeah, thanks dwatts. Upgraded Rails to 2.3.2 and working like a charm.


  • Ben Johnson

    Ben Johnson July 19th, 2009 @ 01:27 PM

    • State changed from “open” to “resolved”

    Thanks for the updates, I'll consider this resolved. Let me know if you have any more issues.

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.

New-ticket Create new ticket

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.

People watching this ticket