I have a controller action that renders a printable version of the page using a print.html.erb
template. The controller code is:
def print
@title = 'Print - Drill'
render :show, layout: 'print', locals: { back_pth: drill_path(@drill) }
end
and in print.html.erb
there is a line:
<%= link_to 'Back', back_pth, class: 'print_link' %>
but this generates an error:
ActionView::Template::Error:
undefined local variable or method `back_pth' for #<#<Class:0x007fd6004e1230>:0x007fd5f7da57d0>
The print template is called by many different controller actions, so how do I fix this? This code worked in rails 5.0.6.