Vincent Woo
2007-Aug-04 05:17 UTC
[Ferret-talk] Can''t find using instance method as field
Hi, I just started experimenting with acts_as_ferret. It''s working
great
if I''m searching through database fields through a setup like:
acts_as_ferret :fields => [''title'']
Page.find_by_contents(''Blue'')
But if I try searching through an instance method, I get no results
back. Anybody know why?
acts_as_ferret :fields => [''extra'']
def extra
''Example''
end
# after deleting the index directory, running "reload!" in the
console:>> Page.find_by_contents(''Example'')
=> #<ActsAsFerret::SearchResults:0x2883ba8 @results=[], @total_hits=0>
It is reindexing since the development.log has many lines like:
creating doc for class: Page, id: 9
Adding field extra with value ''Example'' to index
creating doc for class: Page, id: 10
Adding field extra with value ''Example'' to index
--
Posted via http://www.ruby-forum.com/.