-1

I need to redirect incorrect pages to the 404 page, currently I'm redirecting to the homepage and I have this:

def thirdlevel
    if something
      if something else
        render :template => "services/thirdlevel"
      else
         redirect_to "/"
      end
    else
    redirect_to "/"
  end
end
user1738017
  • 609
  • 2
  • 12
  • 29

1 Answers1

-1

I added the error404 action to my controller and then referenced it that way:

else
  render :action => "error404"
end


def error404
  @breadcrumb = [{:name => "Page not found"}]
end
user1738017
  • 609
  • 2
  • 12
  • 29
  • 1
    -1. Error 404 pages should return a 404 error in the HTTP header and using a breadcrumb to show that a page doesn't exist, is not a good practice in general. – Pigueiras Apr 09 '13 at 20:41