This patch allows you to pass an association as :fields or :additional_fields
Altough, it removes the possibility of referencing a instance variable, but isn't a better practice setup an accessor for instance variables?
The patch iterates over the associated objects calling either to_index or to_s in each of the objects and pushing the returned value to a string, which will be indexed.
Example:
class Person < ActiveRecord::Base
acts_as_ferret :additional_fields => [:addresses]
has_many :addresses
end
class Address < ActiveRecord::Base
def to_index
"#{self.address} #{self.city} #{self.state} #{self.country}"
end
end
Person.find_by_contents("addresses: *whathever*")
I couldn't find the perfect place to document that, so.... :)