2014-04-04 10:08:00 +00:00
|
|
|
module JamRuby
|
|
|
|
|
class EmailBatchSet < ActiveRecord::Base
|
|
|
|
|
self.table_name = "email_batch_sets"
|
|
|
|
|
|
|
|
|
|
belongs_to :email_batch, :class_name => 'JamRuby::EmailBatch'
|
|
|
|
|
|
2014-05-16 07:58:06 +00:00
|
|
|
def self.load_set(batch, user_ids)
|
2014-04-04 10:08:00 +00:00
|
|
|
bset = self.new
|
2014-05-16 07:58:06 +00:00
|
|
|
bset.email_batch_id = batch.id
|
2014-04-04 10:08:00 +00:00
|
|
|
bset.user_ids = user_ids.join(',')
|
|
|
|
|
bset.started_at = Time.now
|
2014-04-05 18:52:12 +00:00
|
|
|
bset.batch_count = user_ids.size
|
2014-04-04 10:08:00 +00:00
|
|
|
bset.save!
|
|
|
|
|
bset
|
|
|
|
|
end
|
2014-05-16 07:58:06 +00:00
|
|
|
|
2014-04-04 10:08:00 +00:00
|
|
|
end
|
|
|
|
|
end
|