Skip to content

Unable to reindex associated models in after_save/delete callbacks #12

@heaven

Description

@heaven

What I am doing is:

class Site < ActuveRecord::Base
  has_many :site_relationships, :dependent => :destroy
  has_many :profiles, :through => :site_relationships

  after_save :reindex_profiles

  def reindex_profiles
    Sunspot.index!(self.profiles)
  end
end

But nothing happen, profile doesn't appear in results, but if I will disable the queue all works as expected.
Also all works if I will run it in this way:

site = Site.last
site.reindex_profiles

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions