#delayed_job_monitor.establish_connection module DelayedJobMonitor class Job < ActiveRecord::Base self.table_name = "delayed_jobs" def self.queues @queues = delayed_job_monitor::Job.select(:queue).map(&:queue).compact.uniq.sort return @queues end def host unless DelayedJobMonitor[:database]["host"].blank? return DelayedJobMonitor[:database]["host"] else return "localhost" end end def description details = {} parsed_handler = self.handler.split(/\n/) parsed_handler.map{|x| details[x.split(":")[0].strip.split(/\//).last] = x.split(/\:|\/|\s/).last.strip unless x.blank?} target_class = details["ActiveRecord"] target_id = details["id"].to_s.gsub(/\W/,"").to_i if details["id"].present? performable_class = details["object"] if details["object"].present? performable_method = details["method_name"] if details["method_name"].present? return "Perform #{performable_class}:#{performable_method} on #{target_class}##{target_id}" end end end