我需要将不正确的页面重定向到404页面,目前我正在重定向到主页,我有这个:
def thirdlevel
if something
if something else
render :template => "services/thirdlevel"
else
redirect_to "/"
end
else
redirect_to "/"
end
end
答案 0 :(得分:-1)
我将error404操作添加到我的控制器,然后以这种方式引用它:
else
render :action => "error404"
end
def error404
@breadcrumb = [{:name => "Page not found"}]
end