Class: TagJob
- Inherits:
-
Struct
- Object
- Struct
- TagJob
- Defined in:
- app/models/job/tag_job.rb
Instance Attribute Summary collapse
-
#people_ids ⇒ Object
Returns the value of attribute people_ids.
-
#tag ⇒ Object
Returns the value of attribute tag.
Instance Method Summary collapse
-
#initialize(tag, people) ⇒ TagJob
constructor
A new instance of TagJob.
- #perform ⇒ Object
Constructor Details
#initialize(tag, people) ⇒ TagJob
Returns a new instance of TagJob.
2 3 4 5 |
# File 'app/models/job/tag_job.rb', line 2 def initialize(tag, people) self.tag = tag self.people_ids = Array.wrap(people).map(&:id) end |
Instance Attribute Details
#people_ids ⇒ Object
Returns the value of attribute people_ids
1 2 3 |
# File 'app/models/job/tag_job.rb', line 1 def people_ids @people_ids end |
#tag ⇒ Object
Returns the value of attribute tag
1 2 3 |
# File 'app/models/job/tag_job.rb', line 1 def tag @tag end |
Instance Method Details
#perform ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'app/models/job/tag_job.rb', line 7 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 |