Class: Plugins::CamaSubscriber::Promotion
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Plugins::CamaSubscriber::Promotion
- Defined in:
- app/models/plugins/cama_subscriber/promotion.rb
Instance Method Summary collapse
-
#add_groups(group_ids = []) ⇒ Object
add this item into groups.
- #sent! ⇒ Object
-
#sent? ⇒ Boolean
boolean sent or pending campaign.
Instance Method Details
#add_groups(group_ids = []) ⇒ Object
add this item into groups
11 12 13 14 15 16 17 |
# File 'app/models/plugins/cama_subscriber/promotion.rb', line 11 def add_groups(group_ids = []) g = self.groups.pluck(:id) self.promotion_groups.where(group_id: g - group_ids).destroy_all (group_ids - g).each do |g_id| self.promotion_groups.create(group_id: g_id) end end |
#sent! ⇒ Object
24 25 26 |
# File 'app/models/plugins/cama_subscriber/promotion.rb', line 24 def sent! self.update(status: 'sent') end |
#sent? ⇒ Boolean
boolean sent or pending campaign
20 21 22 |
# File 'app/models/plugins/cama_subscriber/promotion.rb', line 20 def sent? self.status == 'sent' end |