Delayed Jobs

<%= table_for @delayed_jobs, class: "striped autofit" do |t| %> <% t.column :queue %> <% t.column "Name" do |job| %> <%= raw print_name(job) %> <% end %> <% t.column "Handler", td: {class: "col-expand"} do |job| %> <%= raw print_handler(job) %> <% end %> <% t.column :attempts %> <% t.column "Last error", td: {class: "col-expand"} do |job| %> <% if job.last_error %> <%= job.last_error.split(/\n/)[0] %> <%= job.last_error.split(/\n/)[1..-1].grep(/releases/).join("\n") %> <% end %> <% end %> <% t.column "Failed at" do |job| %> <%= time_ago_in_words_tagged(job.failed_at) if job.failed_at %> <% end %> <% t.column "Run at" do |job| %> <%= time_ago_in_words_tagged(job.run_at) %> <% end %> <% t.column column: "control" do |job| %> <% if DelayedJobPolicy.new([CurrentUser.user, request], job).update? %> <% if job.locked_at? %> Running <% elsif job.failed? %> <%= link_to "Retry", retry_delayed_job_path(job), method: :put, remote: true %> | <%= link_to "Delete", delayed_job_path(job), method: :delete, remote: true %> <% else %> <%= link_to "Run", run_delayed_job_path(job), method: :put, remote: true %> | <%= link_to "Cancel", cancel_delayed_job_path(job), method: :put, remote: true %> <% end %> <% end %> <% end %> <% end %> <%= numbered_paginator(@delayed_jobs) %>