Mysterious Rails Crashes

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


What’s in your development.log?

On Dec 6, 1:27 pm, Emmett S. [email protected]

Matt W. wrote:

What’s in your development.log?

On Dec 6, 1:27 pm, Emmett S. [email protected]

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 at 2007-12-06 11:52:49)
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 = WHERE (name =
‘persistent_cookie’ and val =
‘emmett|f91c80c4b2e1590e98092cca54d514ba6127c57c|Wed Dec 19 12:08:25
-0800 2007’)
MemCache get (0.012725)
Rendering live/errorer

…it just cuts off there.

Array already has a sum method on it (inherited from Enumerable). I
recommend over-riding a built-in class’s method unless you know exactly
it does.

On Dec 7, 2007 12:55 PM, Emmett S. [email protected]

Posted via

Ryan B.

$ irb

[1, 2, 3].sum
NoMethodError: undefined method `sum’ for [1, 2, 3]:Array
from (irb):1

Maybe I have a different version of Ruby?

$ ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.9.1]

That’s why I added it…Array#sum didn’t seem to exist.

Did it appear in some other version of ruby?


I figured it out!

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.

Sorry to have bothered everyone.


Bingo. Rails adds it’s own Array#sum, and adding mine must be causing a

That’s what I get for treating Rails like Ruby… :stuck_out_tongue:

Thanks, I understand what’s going on now.


I think it might be added in rails? Try script/console.

On Dec 7, 2007 1:28 PM, Emmett S. [email protected]

Ryan B.

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.


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.

| Privacy Policy | Terms of Service | Remote Ruby Jobs