Sha256: 97597b8616233f2001282c7ba51a1a981dc157f4d846719d3e2cfe9a523b73f5

Contents?: true

Size: 366 Bytes

Versions: 35

Compression:

Stored size: 366 Bytes

Contents

class TagJob < Struct.new(:tag, :people_ids)
  def initialize(tag, people)
    self.tag = tag
    self.people_ids = Array.wrap(people).map(&:id)
  end

  def perform
    Person.where(:id => self.people_ids).each do |p|
      p.tag_list << self.tag unless p.tag_list.include? self.tag
      p.skip_commit = true
      p.save
    end
    Sunspot.delay.commit
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
artfully_ose-1.2.0.pre.11 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.10 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.9 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.8 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.7 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.6 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.5 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.4 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.3 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.2 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.1 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre app/models/job/tag_job.rb
artfully_ose-1.1.0 app/models/job/tag_job.rb
artfully_ose-1.1.0.rc2 app/models/job/tag_job.rb
artfully_ose-1.1.0.rc1 app/models/job/tag_job.rb