Guest User

Untitled

a guest
Jun 20th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. class SolrWorker
  2. @queue = 'solr'
  3.  
  4. def self.perform(ids, options={})
  5. options.symbolize_keys!
  6. options.assert_valid_keys(:time_zone, :commit)
  7. Time.zone = options[:time_zone] if options[:time_zone]
  8. objects = []
  9. ids.each_pair do |class_name, instance_ids|
  10. objects.concat(class_name.constantize.find_all_by_id(instance_ids))
  11. end
  12. Sunspot.index(objects)
  13. Sunspot.commit if options[:commit]
  14. end
  15. end
Add Comment
Please, Sign In to add comment