3 # mixed into the FerretResult and AR classes calling acts_as_ferret
4 module ResultAttributes
5 # holds the score this record had when it was found via
7 attr_accessor :ferret_score
9 attr_accessor :ferret_rank
12 class FerretResult < ActsAsFerret::BlankSlate
13 include ResultAttributes
17 def initialize(model, id, score, rank, data = {})
18 @model = model.constantize
25 def method_missing(method, *args, &block)
26 if @ar_record || !@data.has_key?(method)
27 to_record.send method, *args, &block
34 methods.include?(name.to_s) || @data.has_key?(name.to_sym) || to_record.respond_to?(name)
39 @ar_record = @model.find(id)
40 @ar_record.ferret_rank = ferret_rank
41 @ar_record.ferret_score = ferret_score