This used to work -
render file: "public/404.html", status: :not_found
After updating to Rails 6.1, it no longer works with this error -
render file: should be given the absolute path to a file. 'public/404.html' was given instead
The problem with the absolute path is doesn't insert the file into my page properly...so I settled on this -
render html: Rails.public_path.join('404.html.erb').read.html_safe, status: :not_found, layout: 'application'
That works but...it will no let me use any Rails ERB code like this -
<% content_for :head do %>
<title>404 Error - Not Found</title>
<meta name="description" content="404 Error - Not Found">
<% end %>
Anyone have any idea on how to make this work?
Thanks
It works for me with
File.join
: