[LRUG] To debug the impossible bug

Simon Coffey simon at tribesports.com
Wed Aug 3 05:59:46 PDT 2011


Hi Murray,

On 3 August 2011 13:44, Murray Steele <murray.steele at gmail.com> wrote:
> Ah, well, probably not then :)  Although once ActiveRecord has got it's
> grubby mitts on things who knows what might happen given that what you are
> delegating to might be an association object which is never really nil
> (proxy objects woo!) until you least expect it.

For the record, background is an AR attribute on the Question model,
no delegation involved.

> Speaking of AR, is it possible that @question is a scope call that hasn't
> resolved yet?  e.g. it's not nil, because it's a scope proxy object, but
> when you try to call a method on it, it resolves the scope to fetch the
> object, which then turns out to be nil?  (I am clutching at straws here I
> think).

It's a great suggestion, but unfortunately, wherever @question is set,
it's set with a regular model instance, no scope funkiness going on.
Also, on the page where we saw this particular example of the bug,
@question should never have been set at all - the request was handled
by a controller that has nothing whatsoever to do with questions.

Cheers,
Simon



More information about the Chat mailing list