Is there any way to set a field name that is different than the method
name used to populate it?
My example:
In Rails, I’m using acts_as_ferret on a Article model that has_many
Authors. I want to be able to index authors’ names with each article.
Since @article.authors yields an array of Author objects (and not an
indexable string), I’ve created this method in my Article model:
def authors_aaf
@authors.collect {|a| a.name }.to_sentence
end
I call it “authors_aaf” because “authors” would cause a conflict. But I
want my field name to be “authors”, because that makes the most sense.
(Users shouldn’t have to type “authors_aaf:Joe” to search by author.)
Any idea how this can/should be done?