Rails adds css class if page has 404 status

Is there a way in Rails to add a class to the html tag if the current page displayed a 404 error.

On my controller, if a user visits the wrong site, he displays the file in a public error with a 404 error like this

else
  render file: 'public/error', status: 404, formats: [:html]
end

I want to add a class to the footer hiddento hide the footer if this page is displayed. I tried this with no luck (but it was more likely an assumption)

<%= "hidden" if current_page?(status: 404) %>

Any suggestions

+3
source share
2 answers

@variable, . 500 , .

else
  @hide_footer = true
  render file: 'public/error', status: 404, formats: [:html]
end

<%= "hidden" if @hide_footer %>

.

+1

else
    render :template => "shared/404", :layout => 'errorlayout', :status => 404
end

, :

Rails 3

? - , , .

0

All Articles