Why would a route method not work in my layout?-Collection of common programming errors

Rake Routes lists:

program_reports GET    /programs/:program_id/reports(.:format)               reports#index

Yet putting this in a layout file (programs.html.erb)


gives me an error:

undefined method `program_reports' for #

I don’t know if this matters, but note that the layout is part of a nested layout structure, and so the view is rendered with something like this:

respond_with @partocipants do |format|
  format.html {
    render layout: 'layouts/progtabs'
  }
end

Any idea what is wrong here?

  1. The ‘program_reports’ route provides ‘program_reports_path’ and ‘program_reports_url’ to your views. Try:

    
    

Originally posted 2013-11-09 22:47:28.