#114 new
eric

Search via params not mapping to named scopes

Reported by eric | September 1st, 2009 @ 02:06 PM

First off let me say this plugin is not only ambitious as hell, it's amazing and extremely elegant. Well done!

I am running Rails 2.3.2 and searchlogic 2.3.2.

Given two ways to use searchlogic:

  1. Customer.first_name_like("test")
  2. Customer.search(:first_name_like => "test")

(1) works great. (2) gives me all the records in the database, as if the params are not mapping to their appropriate named scope.

Any ideas where I could look to start troubleshooting this?

Thanks to anyone who can help.

e

Comments and changes to this ticket

  • eric

    eric October 22nd, 2009 @ 02:41 PM

    • Assigned user cleared.

    Resolved!

    Sorry to bother people on this.
    I had a plugin "global_scope" that was preventing me from chaining named_scopes together. This was causing problems of course for the searchlogic plugin, as it uses the hell out of chaining named scopes.

    If you have this same issue, try making sure that you can chain conditional named_scopes together.

    Article.active.published
    should give you the same results as
    Article.published.active

    But if your named scopes aren't working properly, you'll notice in your log that the query is only including conditions from the first named scope. Argh!

    HTH

    -e

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