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.3.0.pre4 app/models/job/tag_job.rb
artfully_ose-1.3.0.pre3 app/models/job/tag_job.rb
artfully_ose-1.3.0.pre2 app/models/job/tag_job.rb
artfully_ose-1.3.0.pre1 app/models/job/tag_job.rb
artfully_ose-1.2.0 app/models/job/tag_job.rb
artfully_ose-1.2.0.beta.1 app/models/job/tag_job.rb
artfully_ose-1.2.0.alpha.2 app/models/job/tag_job.rb
artfully_ose-1.2.0.alpha.1 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.27 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.26 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.24 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.23 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.21 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.20 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.19 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.18 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.17 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.16 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.15 app/models/job/tag_job.rb
artfully_ose-1.2.0.pre.12 app/models/job/tag_job.rb