Method: Resque::Plugins::DataWarehouse::Transaction#enqueue

Defined in:
lib/resque/plugins/data_warehouse/transaction.rb

#enqueue(model, action = 'save') ⇒ Object



37
38
39
40
41
42
43
# File 'lib/resque/plugins/data_warehouse/transaction.rb', line 37

def enqueue(model, action = 'save')
  record = TransactionRecord.new(model.id, model.class.to_s, model.updated_at, model.attributes, action)
  Resque.redis.rpush(record.transaction_key, record.transaction_data.to_json)
  Resque.enqueue(self.class, model.id, model.class.to_s, model.updated_at)
rescue Exception => ex
  puts "transaction failing due to exception #{ex.inspect} #{ex.backtrace.join("\n")}"
end