Jesse Grosjean wrote:

> Thanks I was missing that part. Now it's working, or almost. The on 
> trouble spot is that when I highlight my results the models do get 
> loaded. I guess is this because FerretResult doesn't have a highlight 
> method, and that causes it to load the underlying model.
> 
> To get around this I've changed from:
> 
> result.highlight(...)
> 
> to:
> 
> result.model.aaf_index.highlight(result.id, result.model.name...)
> 
> After doing that the database is no longer hit when displaying 
> highlighted ferret results, but to do that I needed to add 
> "attr_accessor :model" to ActsAsFerret > ResultAttributes. Is there a 
> better way to do that? If not could you add that attr_accessor to ferret 
> proper?
> 
> It might also make sense to also add the highlight method to 
> FerretResult to avoid the model load, but I'd still like some way to 
> access the model class without requiring a model load since I need that 
> to generate the right link the the original page for each result.

I just posted a ticket that implements this, preventing use of the
highlight method from triggering unnecessary loading of the real AR record:

http://projects.jkraemer.net/acts_as_ferret/ticket/161

-- 
We develop, watch us RoR, in numbers too big to ignore.

_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to