
to_conditions(value) has wrong type
Reported by Slava | April 2nd, 2009 @ 03:59 PM
Hello.
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(',')] end end Searchlogic::Conditions::Base.register_condition(In)
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.
Thanks
Slava.
Comments and changes to this ticket
-
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 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.
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.
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.