Sha256: 6548b0e2315e7bfd8534f88f0ee3bb002b36bfea6c56eb9d906fa725faad16c2
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
module RulesEngine module Process class ReProcessAudit < ActiveRecord::Base validates_presence_of :code scope :by_process_id, lambda {|process_id| where('process_id = ?', process_id)} scope :order_created_at, lambda {|order| order("created_at #{order}, id #{order}") } def self.history(process_id, options = {}) klass = self klass = klass.by_process_id(process_id) klass = klass.order_created_at('ASC') klass.find(:all) end end class DbAuditor < Auditor def initialize(*options) end def audit(process_id, message, code = RulesEngine::Process::AUDIT_INFO) if perform_audit?(code) # $stderr.puts("#{'*' * 5} #{process_id}, #{code}, #{message}") ReProcessAudit.create({ :process_id => process_id, :created_at => Time.now, :code => code, :message => message}); end end def history(process_id, options ={}) re_process_audits = ReProcessAudit.history(process_id, options) { "audits" => re_process_audits.map do |re_process_audit| { "process_id" => re_process_audit.process_id, "created_at" => re_process_audit.created_at.utc.to_s, "code" => re_process_audit.code, "message" => re_process_audit.message } end } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rules_engine-0.3.0 | lib/rules_engine/process/auditor/db_auditor.rb |