Inexplicable 'Application error (Rails)' in production

I’m hoping someone can point out something obvious I’m not seeing.
Heres the problem:

When in production mode, when an error occurrs I get the white screen
error:

Application error (Rails),

And, I can’t seem to override the method rescue_action_in_public, even
though I’m certain local_request? is returning false. If I try to
just render some text to the screen, inside that method in my
application controller class, I still get the ‘Application error
(Rails)’ error. So, I can’t implement any exception handling in
public. Now, I can set

config.action_controller.consider_all_requests_local = true

and I can see the error. So, somehow the request is NOT being seen as
local, yet any attempts to catch it aren’t working. Help. :slight_smile:

Thanks!

Rich

If you are getting this error, it¹s a 500 server error. Your dispatcher
is
never even seeing it. Look at the error-page specification to see what
page
is displayed in the case of a 500 � I¹ll bet it¹s the page you are now
seeing.

Steve

Rich B. wrote:

When in production mode, when an error occurrs I get the white screen error:

Application error (Rails),

And, I can’t seem to override the method rescue_action_in_public, even
though I’m certain local_request? is returning false.

What is the error, and where are you redefining
rescue_action_in_public?

Some Rails errors sort of occur before your controller ever enters the
picture (don’t ask me for details!). If you’re redefining
rescue_action_in_public in your controller (or even in your
ApplicationController, I think), errors like that will trigger the
built-in rescue_action_in_public since Rails hasn’t reached your
controller yet.

Maybe this is what’s happening in your app? It’s hard to tell without
knowing what the exception is, where it’s occurring
and
where you’re redefining the method.

In my apps I redefine rescue_action_in_public in a little ‘support’
file in /lib that I include in environment.rb. It seems to catch pretty
much everything.

/config/environment.rb:

require ‘myapp_support’

/lib/myapp_support.rb:

module ActionController
module Rescue
protected
def rescue_action_in_public(exception)
case exception
when RoutingError, UnknownAction then
render_text(IO.read(File.join(RAILS_ROOT, ‘public’,
‘404.html’)), “404 Not Found”)
else
render_text(IO.read(File.join(RAILS_ROOT, ‘public’,
‘500.html’)), “500 Internal Error”)
end
end
end
end

(I’m pretty sure I just copy-pasted this from somewhere in the past,
but I can’t remember from where that might have been.)

Chris

It turned out to be a plugin I was using, ‘meantime_filter’ I havent’
looked into the code enough to know exaclty why yet, but i plan
to…thanks for the help though.

On 9/8/06, Chris M. [email protected] wrote:

where you’re redefining the method.

‘500.html’)), “500 Internal Error”)


Rich B.
http://brantinteractive.com
[email protected]
v. 267.640.2195 f. 215.689.1454