Whenever an exception is thrown (and not caught) during rendering in
my Rails application, Rails dies immediately with no stack trace or
error screen. The symptom is, from the outside, “pages with errors
look blank white”, but I’m pretty sure that’s just what you see when a
connection is closed and no response has been sent from the server.
Does anyone have any idea what could be causing this, or how to find
out? I have replicated it running Rails under Mongrel,
lighttpd/fastcgi, and webrick (even in debug mode), all with exactly
the same results - no information, no stack traces, just a sudden
halt.
I have a reduced test case: a layoutless render of a template containing
“<% raise ‘foo’ %>”
This is what the log looks like:
Processing LiveController#errorer (for 127.0.0.1 at 2007-12-06 11:52:49)
[GET]
Session ID: 85a4ebcc60791ecbb58db428ef191a66
Parameters: {“action”=>“errorer”, “controller”=>“live”}
User Load Including Associations (0.074950) SELECT users.“id” AS
t0_r0, users.“login” AS t0_r1, users.“password_hash” AS t0_r2,
users.“stream_key” AS t0_r3, users.“viewer_karma” AS t0_r4,
users.“publisher_karma” AS t0_r5, users.“updated_on” AS t0_r6,
users.“created_on” AS t0_r7, users.“fans_count” AS t0_r8,
users.“dmca_violation” AS t0_r9, users.“terms_of_service_violation” AS
t0_r10, user_properties.“id” AS t1_r0, user_properties.“user_id” AS
t1_r1, user_properties.“name” AS t1_r2, user_properties.“kind” AS t1_r3,
user_properties.“val” AS t1_r4 FROM users LEFT OUTER JOIN
user_properties ON user_properties.user_id = users.id WHERE (name =
‘persistent_cookie’ and val =
‘emmett|f91c80c4b2e1590e98092cca54d514ba6127c57c|Wed Dec 19 12:08:25
-0800 2007’)
MemCache get (0.012725)
Rendering live/errorer
Array already has a sum method on it (inherited from Enumerable). I
wouldn’t
recommend over-riding a built-in class’s method unless you know exactly
what
it does.
I had extended class Array with a sum method; apparently Rails does not
like that for some reason, because once I renamed it sum_all there was
no problem.
ActiveRecord adds its own Array#sum (it might actually be on
Enumerable–this is from 6mo memory) that takes an additional parameter.
If you define it in the obvious was, kaboom!, but if you don’t define it
yourself the one they provide works fine.
–MarkusQ
Sent via BlackBerry from T-Mobile
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.