To edit pages or tickets please login with username/password: aaf/aaf

Ticket #161 (assigned enhancement)

Opened 1 year ago

Last modified 1 year ago

Prevent unnecessary DB access when highlight method is called on FerretResult objects

Reported by: aaf Assigned to: jk (accepted)
Priority: minor Milestone: 0.5
Component: 0plugin Version:
Keywords: Cc:

Description

This is a more general solution to the problem referred to in Ticket #158: Use of the the highlight method on a FerretResult? object triggering loading of the AR model instance even when the highlighted fields can be lazy loaded.

Add the following to the top of the method_missing method in ferret_result.rb

if [:highlight, :document_number, :query_for_record].include?(method.to_sym)
  @model.send method, id, *args
elsif ...

Then add highlight, document_number, and query_for_record AAF class methods, each taking an id first parameter, and change the instance methods to call these class methods.

One other useful addition to ferret_result to prevent unnecessary AR loading is:

def [](attr) method_missing(attr) end

Change History

08/26/07 19:48:12 changed by jk

  • status changed from new to assigned.
  • milestone set to 0.5.

To edit pages or tickets please login with username/password: aaf/aaf