|
Index help on Polymorphic Associations: msg#00075lang.ruby.ferret.general
Hello, I'm a newbie to aaf and rails and I hope anyone can help me with this. I have the following Models: class Project < ActiveRecord::Base acts_as_authorizable acts_as_audited :except => [:created_by, :updated_by ], :user_class_name => 'AuthenticatedSystem', :user_method => 'current_user' acts_as_ferret :fields => {:name => {:store => :yes}, :description => {:store => :yes}, :project_notes => {:store => :yes}} has_many :notes, :as => :notable ..... def project_notes @index = Array.new for note in self.notes @index << note.details end @index.join(" ") end .......... class Note < ActiveRecord::Base acts_as_authorizable acts_as_audited :except => [:created_by, :updated_by ], :user_class_name => 'AuthenticatedSystem', :user_method => 'current_user' acts_as_ferret :fields => {:details => {:store => :yes}, :notable_id => {}, :notable_type => {}} belongs_to :notable, :polymorphic => true .......... But when i searched for a project with the note 'test': @results = Project.find_by_contents('test') it returns 0 results. I checked in the logs and it created the index: Processing NotesController#create (for 127.0.0.1 at 2006-12-11 13:53:53) [POST] ....... creating doc for class: Note, id: 17 Adding field notable_id with value '9' to index Adding field details with value 'test project 9' to index Adding field notable_type with value 'Project' to index ....... I also added this to the NotesController: def create @note = Note.new(params[:note]) @note.disable_ferret(:index_when_finished) do @successful = @note.save end ..... end This doesn't seem to work either, but after I have rebuild the index, the note 'test' now appears on the results. Did I miss something here? Any help is greatly appreciated. Thanks much, Jackie -- Posted via http://www.ruby-forum.com/. |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: QueryParser Exception Handling Problem: 00075, Mark |
|---|---|
| Next by Date: | Re: Index help on Polymorphic Associations: 00075, Jens Kraemer |
| Previous by Thread: | Using custom stem analyzer giving mongrel errorsi: 00075, Raymond O'connor |
| Next by Thread: | Re: Index help on Polymorphic Associations: 00075, Jens Kraemer |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |