#75 ✓resolved
omarvelous

NoMethodError - nil.class_name

Reported by omarvelous | March 28th, 2009 @ 10:59 AM

Recently took the leap to Rails 2.3.2... Now my searchlogic broke...

Example


class PeopleController < ApplicationController
  def index
    @body_id = "People"
    
    @search = Person.new_search(params[:search])
    @people, @people_count = @search.all, @search.count
  end
end

Returns


/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/reflection.rb:316:in `derive_class_name'
/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/reflection.rb:112:in `class_name'
/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/reflection.rb:316:in `derive_class_name'
/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/reflection.rb:112:in `class_name'
/webapp/vendor/plugins/searchlogic/lib/searchlogic/conditions/magic_methods.rb:61:in `add_associations!'
/webapp/vendor/plugins/searchlogic/lib/searchlogic/conditions/magic_methods.rb:56:in `each'
/webapp/vendor/plugins/searchlogic/lib/searchlogic/conditions/magic_methods.rb:56:in `add_associations!'
/webapp/vendor/plugins/searchlogic/lib/searchlogic/conditions/magic_methods.rb:46:in `initialize'
/webapp/vendor/plugins/searchlogic/lib/searchlogic/search/conditions.rb:17:in `new'
/webapp/vendor/plugins/searchlogic/lib/searchlogic/search/conditions.rb:17:in `initialize'
/webapp/vendor/plugins/searchlogic/lib/searchlogic/active_record/base.rb:191:in `new'
/webapp/vendor/plugins/searchlogic/lib/searchlogic/active_record/base.rb:191:in `searchlogic_search'
/webapp/vendor/plugins/searchlogic/lib/searchlogic/active_record/base.rb:65:in `new_search'
/webapp/app/controllers/people_controller.rb:14:in `index'

Tried to follow your code to figure out why... kind of got lost...

Not sure why it's not working...

Any additional info needed, let me know!

Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson March 30th, 2009 @ 11:47 AM

    • State changed from “new” to “open”

    If I had to guess this is due to a relationship that is not set up properly. Regardless, can you please create a failing test, and then I can fix the issue. By test, I mean a test I can run in the searchlogic test suite. I apologize for asking you to do this, but its a new policy I am implementing with my open source projects. I am just very busy and this would help me easily knock out the issue.

  • Ben Johnson

    Ben Johnson April 16th, 2009 @ 03:36 AM

    • State changed from “open” to “resolved”

    I am certain you have a rogue relationship or a misspelled one, I see this error all that time and that is always the cause.

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

Pages