Daniel
2006-Nov-27 06:14 UTC
[Ferret-talk] find_conditions in acts_as_ferret find_by_contents
Hi all, Every time I try to add options for the find_conditions argument of find_by_contents I get the following: a = AnnotatedLink.find_by_contents(''test'', {}, {:conditions => ''category_id IS NOT NULL''})>> NoMethodError: You have a nil object when you didn''t expect it!You might have expected an instance of Array. The error occured while evaluating nil.sort! from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/class_methods.rb:288:in `find_by_contents'' from (irb):1 I''m using rev 112 of acts_as ferret and the latest version of ferret. Has anyone else had this problem? Thanks! Daniel -- Posted via http://www.ruby-forum.com/.
Daniel
2006-Nov-27 06:29 UTC
[Ferret-talk] find_conditions in acts_as_ferret find_by_contents
I think I found the problem. On line 470, this: def combine_conditions(conditions, additional_conditions) should be this: def combine_conditions(conditions, *additional_conditions) Furthermore, the rescue clause at 282 might be more usefull if it reraised the error Thanks! Daniel wrote:> Hi all, > > Every time I try to add options for the find_conditions argument of > find_by_contents I get the following: > > a = AnnotatedLink.find_by_contents(''test'', {}, {:conditions => > ''category_id IS NOT NULL''}) >>> NoMethodError: You have a nil object when you didn''t expect it! > You might have expected an instance of Array. > The error occured while evaluating nil.sort! > from > ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/class_methods.rb:288:in > `find_by_contents'' > from (irb):1 > > I''m using rev 112 of acts_as ferret and the latest version of ferret. > Has anyone else had this problem? > > Thanks! > Daniel-- Posted via http://www.ruby-forum.com/.
Jens Kraemer
2006-Nov-30 14:13 UTC
[Ferret-talk] [AaF] find_conditions in acts_as_ferret find_by_contents
On Mon, Nov 27, 2006 at 07:29:09AM +0100, Daniel wrote:> I think I found the problem. On line 470, this: > > def combine_conditions(conditions, additional_conditions) > > should be this: > > def combine_conditions(conditions, *additional_conditions)correct, that way it works with a single string as conditions argument, too.> Furthermore, the rescue clause at 282 might be more usefull if it > reraised the errorI changed the rescue to only catch RecordNotFound errors, and raised the log level to warn. just committed. Jens -- webit! Gesellschaft f?r neue Medien mbH www.webit.de Dipl.-Wirtschaftsingenieur Jens Kr?mer kraemer at webit.de Schnorrstra?e 76 Tel +49 351 46766 0 D-01069 Dresden Fax +49 351 46766 66
Possibly Parallel Threads
- Wrong total_hits when using conditions in find_by_contents
- Pagination problem with acts_as_ferret
- How do you use acts_as_ferret without rails?
- Wrong total_hits when using conditions in find_by_contents
- cannot use acts_as_ferret on legacy tables or tables with a