# Symfony like "forward404"

**URL:** <https://www.ruby-forum.com/t/symfony-like-forward404/141406>\
**Category:** Rails\
**Created:** [June 25, 2008, 3:47pm UTC](https://www.ruby-forum.com/t/symfony-like-forward404/141406 "2008-06-25T15:47:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![christoph](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eb8c5e/32.png) [@christoph](https://www.ruby-forum.com/u/christoph)\
**Post date:** [June 25, 2008, 3:47pm UTC](https://www.ruby-forum.com/t/symfony-like-forward404/141406/1 "2008-06-25T15:47:00Z")

</div>

Hi community,  
as I’m a previous PHP and especially symfony programmer, I often try  
to find features of symfony in rails. Now I’m looking for a method  
which forwards to a 404 error page (but with stack trace and so on in  
development mode). I tried to manually render public/404.html, but if  
I do so, I miss the stack trace. Is there a method like this or are  
rails programmers using a different approach to show a 404 error ? I  
hope you understand my problem and help me solving it !

Thank you very much in advance,  
Christoph

---

<div class="post-metadata">

**Author:** ![christoph](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eb8c5e/32.png) [@christoph](https://www.ruby-forum.com/u/christoph)\
**Post date:** [June 26, 2008, 12:03pm UTC](https://www.ruby-forum.com/t/symfony-like-forward404/141406/2 "2008-06-26T12:03:02Z")

</div>

Does nobody has any ideas ?

---

<div class="post-metadata">

**Author:** ![christoph](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eb8c5e/32.png) [@christoph](https://www.ruby-forum.com/u/christoph)\
**Post date:** [June 26, 2008, 12:09pm UTC](https://www.ruby-forum.com/t/symfony-like-forward404/141406/3 "2008-06-26T12:09:29Z")

</div>

On 26 Jun 2008, at 11:02, Christoph wrote:

> > rails programmers using a different approach to show a 404 error ? I  
> > hope you understand my problem and help me solving it !

In dev mode (or in production mode if you ask for it) if you don’t  
handle an exception you’ll get a stack trace etc… Is that what  
you’re looking for?

Fred

---

<div class="post-metadata">

**Author:** ![christoph](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eb8c5e/32.png) [@christoph](https://www.ruby-forum.com/u/christoph)\
**Post date:** [June 26, 2008, 12:10pm UTC](https://www.ruby-forum.com/t/symfony-like-forward404/141406/4 "2008-06-26T12:10:04Z")

</div>

I don’t think anybody used it this way, since there  
is not much reason to do it. I won’t show a stack trace  
to my users in production, because that’s not their business  
and in development I get the debug info I need from  
development.log or the server output.

---

<div class="post-metadata">

**Author:** ![christoph](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eb8c5e/32.png) [@christoph](https://www.ruby-forum.com/u/christoph)\
**Post date:** [June 26, 2008, 1:12pm UTC](https://www.ruby-forum.com/t/symfony-like-forward404/141406/5 "2008-06-26T13:12:45Z")

</div>

Maybe you don’t understand my question: I’m searching for a  
possibility to show a 404 error page, something like this code:  
redirect\_to\_404 unless request.xhr?  
Is there a method like redirect\_to\_404, or are rails developers using  
a different approach ?

Christoph

---

<div class="post-metadata">

**Author:** ![christoph](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eb8c5e/32.png) [@christoph](https://www.ruby-forum.com/u/christoph)\
**Post date:** [June 26, 2008, 1:47pm UTC](https://www.ruby-forum.com/t/symfony-like-forward404/141406/6 "2008-06-26T13:47:18Z")

</div>

On 26 Jun 2008, at 13:12, Christoph wrote:

> Maybe you don’t understand my question: I’m searching for a  
> possibility to show a 404 error page, something like this code:  
> redirect\_to\_404 unless request.xhr?  
> Is there a method like redirect\_to\_404, or are rails developers using  
> a different approach ?

render :file =\> “#{RAILS\_ROOT}/public/404.html”, :status =\> 404 and  
return

As weird as it may sound, there’s a whole section in the API that  
talks about this:  
[http://api.rubyonrails.com/classes/ActionController/Base.html#M000852](http://api.rubyonrails.com/classes/ActionController/Base.html#M000852)

Best regards

Peter De Berdt
