Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
class RemoveRecordFromSolr
@queue = :high
def self.perform(klass, id)
klass.constantize.find(id).remove_from_index!
end
end
class IndexRecordInSolr
@queue = :high
def self.perform(klass, id)
klass.constantize.find(id).index!
end
end
class SolrObserver < ActiveRecord::Observer
observe Company, Customer, Todo, Deal, Message, PhoneCall
def after_save(record)
return if ENV['POPULATING']
Resque.enqueue IndexRecordInSolr, record.class.to_s, record.id
end
def before_destroy(record)
return if ENV['POPULATING']
Resque.enqueue RemoveRecordFromSolr, record.class.to_s, record.id
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.