You're right that :auto_index and :auto_remove don't apply to associated objects, just the searchable object they are specified on When denormalizing, you should use after_save hooks on the associated objects to trigger a reindex where necessary. In this case, you want changes to the Activity model and the FieldnoteActivity join model to trigger a reindex of their associated Fieldnote objects when saved or destroyed class Fieldnote has_many :fieldnote_activities has_many :activities, :through => :fieldnote_activities searchable do # index denormalized data from activities end end class FieldnoteActivity has_many :fieldnotes has_many :activities after_save :reindex_fieldnotes before_destroy :reindex_fieldnotes def reindex_fieldnotes Sunspot. Index(fieldnotes) end end class Activity has_many :fieldnote_activities has_many :fieldnotes, :through => :fieldnote_activities after_save :reindex_fieldnotes before_destroy :reindex_fieldnotes def reindex_fieldnotes Sunspot.
Index(fieldnotes) end end.
You're right that :auto_index and :auto_remove don't apply to associated objects, just the searchable object they are specified on. When denormalizing, you should use after_save hooks on the associated objects to trigger a reindex where necessary. In this case, you want changes to the Activity model and the FieldnoteActivity join model to trigger a reindex of their associated Fieldnote objects when saved or destroyed.
Class Fieldnote has_many :fieldnote_activities has_many :activities, :through => :fieldnote_activities searchable do # index denormalized data from activities end end class FieldnoteActivity has_many :fieldnotes has_many :activities after_save :reindex_fieldnotes before_destroy :reindex_fieldnotes def reindex_fieldnotes Sunspot. Index(fieldnotes) end end class Activity has_many :fieldnote_activities has_many :fieldnotes, :through => :fieldnote_activities after_save :reindex_fieldnotes before_destroy :reindex_fieldnotes def reindex_fieldnotes Sunspot. Index(fieldnotes) end end.
Thanks very much. I actually ended up using after_destroy (otherwise it would re-index with the association still intact), and instead of doing Sunspot. Index(fieldnotes) I wrote a private method in the FieldnoteActivity model that simply did fieldnote.
Index! (i.e. , re-index one field note rather than all of them).
Thanks for putting me on the right path! – landslide Nov 15 at 20:22.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.