#80 ✓resolved

to_conditions(value) has wrong type

Reported by Slava | April 2nd, 2009 @ 03:59 PM


I have problem with custom Condition.

i am missing the "IN"-SQl-Statement in Searchlogic, so i create a custom Condition.

class In < Searchlogic::Condition::Base
    def to_conditions(value)
         ["#{column_sql} IN (?)", value.join(',')]


In my controller i wrote this:

array = [1,2,3,4]
@search = Model.new_search(params[:search])
@search.conditions.id_in =  array
@result, @result_count = @search.all, @search.count

But i get a error:

NoMethodError (undefined method join' for 1:Fixnum):

The value of function to_conditions has a type: integer

I suppose because the collumn "id" is of type integer.

Is it possible to implement an "IN" function in Searchlogic or there is another way to make a search with given id's.

Background info:

I use Searchlogic for struct search and ferret (acts_as_ferret) to search in files contents.

Now i would to combine both solution.



Comments and changes to this ticket

  • Ben Johnson

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

    • State changed from “new” to “open”

    The method is expecting an array. Somehow the value passed to that meth is not an array. Do you have a back tract? Also, in searchlogic were you able to create a failing test?

  • Ben Johnson

    Ben Johnson July 30th, 2009 @ 02:56 AM

    • State changed from “open” to “resolved”

    This bug looks like its for an older version of searchlogic. If you haven't you should check out v2, I think it will be easier for you use and solve this issue. Thanks.

  • Slava

    Slava July 31st, 2009 @ 10:09 AM

    Hi Ben.

    Yes it works now.

    I use named scope to solve a problem.


    named_scope :id_in_range, lambda { |*args| {:conditions => ["id IN (?)", args.first ]}


    search = Model.search()
    search.id_in_range [1,2,3,4,5,6]


  • seomaster

    seomaster April 11th, 2021 @ 04:24 AM

    I prefer merely excellent resources - you will see these people in: visit this page

  • seomaster

    seomaster April 14th, 2021 @ 06:41 AM

    Mmm.. estimable to be here in your report or notify, whatever, I repute I should moreover process strong for my have website want I play some salubrious further updated busy in your location. online casino

  • seomaster

    seomaster May 8th, 2021 @ 11:17 PM

    I invite you to the page where you can read with interesting information on similar topics. online casino uk

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