Class: Barong::Model::LabelUpdatedConsumer
- Inherits:
-
Object
- Object
- Barong::Model::LabelUpdatedConsumer
- Defined in:
- app/consumers/barong/model/label_updated_consumer.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call(event) ⇒ Object
19 20 21 |
# File 'app/consumers/barong/model/label_updated_consumer.rb', line 19 def call(event) new.call(event) end |
Instance Method Details
#call(event) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'app/consumers/barong/model/label_updated_consumer.rb', line 7 def call(event) key = event[:record][:key] value = event[:record][:value] user = event[:record][:user] Event::Event.where(trigger_key: key, trigger_value: value).each do |event| next if event.participants.exists?(uid: user[:uid]) event.participants.create!(uid: user[:uid]) end end |