Help with this error

24 views
Skip to first unread message

Rails_beginner

unread,
Mar 24, 2015, 6:26:00 AM3/24/15
to rubyonra...@googlegroups.com
I am getting undefined method `delayed_backend_active_record_job_path'
I want to redirect the user to _list_row.html.haml page when they click on a job_id link but somehow I am getting the above error


****delayed_jobs_controller.rb****

class Admin::DelayedJobsController < Admin::BaseController
  load_and_authorize_resource :delayed_job, class: Delayed::Job

  layout "admin"
  

  def index
    @toggle_stats_job = Delayed::Job.where(queue: 'stats').first
    @jobs = Delayed::Job.where("COALESCE(delayed_jobs.queue, '') != 'stats'").order(:run_at)
  end


  def show
    if params[:id].present?
  @jobs = Delayed::Job.where("id = ?"),params[:id]
   format.html { redirect_to admin_delayed_jobs_path(params[:id]) }
  end
    
    respond_to do |format|
      format.json { render(json: {payload: @delayed_job.handler}.to_json) }
      format.html { redirect_to admin_delayed_jobs_path }
    end
  end


  def destroy
  @job = Delayed::Job.find(params[:id])
  @job.destroy
  redirect_to admin_delayed_jobs_path
  end
end

****index****

= render partial: 'admin/delayed_jobs/list'

**** _list.html.haml ****
= render partial: 'admin/delayed_jobs/list_header'
-...@jobs.each do |job|
   = link_to job.id, job
   = render({:partial => 'admin/delayed_jobs/list_row', locals: {job:job}})

**** _list_row.html.haml ****
  %td=job.priority
  %td=job.attempts
  %td=job.created_at
  %td=job.run_at
  %td=job.updated_at
  %td=job.failed_at
  %td=link_to "Delete",admin_delayed_job_path(job), method: :delete 

Colin Law

unread,
Mar 24, 2015, 7:38:39 AM3/24/15
to rubyonra...@googlegroups.com
On 24 March 2015 at 09:44, Rails_beginner <the...@gmail.com> wrote:
> I am getting undefined method `delayed_backend_active_record_job_path'
> I want to redirect the user to _list_row.html.haml page when they click on a
> job_id link but somehow I am getting the above error

Which line of your code is generating the error (it should be given
with the error). If you can't see it post the complete error and
stack trace.

Colin
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/6af8fdea-bbee-4b7d-8fe2-1d1eb4b62b6d%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Frederick Cheung

unread,
Mar 24, 2015, 9:26:09 AM3/24/15
to rubyonra...@googlegroups.com

On Tuesday, March 24, 2015 at 10:26:00 AM UTC, Rails_beginner wrote:
= render partial: 'admin/delayed_jobs/list_header'
-...@jobs.each do |job|
   = link_to job.id, job


This will try to call delayed_backend_active_record_job_path in order to turn the job object into the path (by default the class name is used to select which route should be used). If it should be using something else then you need to be explicit, e.g. 

    link_to job.id, admin_delayed_job_path(job)
 
if that is where it should go

Fred
Reply all
Reply to author
Forward
0 new messages