I just noticed that the auto_complete_result method in the auto_complete plugin calls the field (as opposed to the method) to generate the result list.
Here's what it is:
def auto_complete_result(entries, field, phrase = nil) return unless entries items = entries.map { |entry| content_tag("li", phrase ? highlight(entry[field], phrase) : h(entry[field)) } content_tag("ul", items.uniq) end
I've changed it to (and what I think it should to be) :
def auto_complete_result(entries, method, phrase = nil) return unless entries items = entries.map { |entry| content_tag("li", phrase ? highlight(entry.send(method), phrase) : h(entry.send(method))) } content_tag("ul", items.uniq) end
What is the rationale for using the field rather than the method?