Hi!
On Tue, Sep 05, 2006 at 09:49:29PM +0200, Alastair Moore wrote:
> Jens Kraemer wrote:
>
> > that of course works if :area_id is an indexed field.
> >
> > If area_id is not indexed, the :conditions option can be used to limit
> > the find call that retrieves the model instances via ActiveRecord. Note
> > that you might get less results than expected when using :conditions,
> > since AR filters records out that Ferret counted as a hit.
> >
> > correct usage:
> >
> > @results = SupplierProduct.find_by_contents(params[:search], {}, {
> > :conditions => [] })
> >
> > the first hash is for ferret-related options (like :limit, :offset and
> > so on), the second for activeRecord options.
> >
>
> Hi Jens and thanks for the help but I seem to be getting an error when I
> use the following -
>
> @results = MarketingProduct.find_by_contents(search_text, {},
> :conditions => 'live = "t"')
that should read :conditions => [ "live='t'" ] . the clause gets shifted
from the array and ANDed with aaf's own where clause, and any additional
parameters get added to the conditions array that is the issued to
ActiveRecord.
But that doesn't seem to be your exact problem... What version of aaf do
you use ? From the line number that doesn't seem to be latest trunk or the last
version tagged stable ?
cheers,
Jens
> I'm getting this error -
>
> 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!
>
> #{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb:286:in
> `find_by_contents'
> #{RAILS_ROOT}/app/controllers/marketing_controller.rb:21:in `results'
>
> Any ideas what might be up?
>
> Thanks,
>
> Alastair
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ferret-talk mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/ferret-talk
--
webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [EMAIL PROTECTED]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk