Rake Routes lists:
program_reports GET /programs/:program_id/reports(.:format) reports#index
Yet putting this in a layout file (programs.html.erb)
<li><%= link_to "Reports", program_reports(@program_id) %></li>
gives me an error:
undefined method `program_reports' for #<#<Class:0x007fe98d44baf0>:0x007fe98d465ce8>
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?
The ‘program_reports’ route provides ‘program_reports_path’ and ‘program_reports_url’ to your views. Try: