#92 ✓resolved
etaque (at gmail)

Conflict with a scope on a column beginning with the name of an association

Reported by etaque (at gmail) | June 16th, 2009 @ 05:38 PM

This is a duplicate of the ticket on github (maybe the wrong place to post tickeds ?) :

Giving those models :
User has_many :classifieds

User has the column "classifieds_count".

The following search throws an error, because Searchlogic seems to ignore User.classifieds_count column and try to search on the associated Classified model :

undefined method count_greater_than' for #<Class:0x3db9234>


Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson June 20th, 2009 @ 04:58 AM

    • State changed from “new” to “open”

    Good find, for this I feel like "xxx_count" is obviously a standard, so making a exception for columns like that wouldn't be a huge deal. Also, my regex checks should check the column first anyways. I'll look into this though.

  • Georg Ledermann

    Georg Ledermann July 6th, 2009 @ 12:48 PM

    Simimilar problem here:

    class Debt < ActiveRecord::Base
      belongs_to :creditor, :class_name => 'Contact', :foreign_key => 'creditor_contact_id'
      belongs_to :creditor_ledger, :class_name => 'Ledger', :foreign_key => 'creditor_ledger_id'
    Debt.search(:creditor_ledger_id => 123)
    # => NoMethodError: undefined method `ledger_id_equals' for #<Class:0x268a720>
  • Ben Johnson

    Ben Johnson July 13th, 2009 @ 04:54 PM

    • State changed from “open” to “resolved”

    This has been fixed. Thanks!

  • Georg Ledermann

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