Validating user’s ability using CanCan with model associations

Undefined methods on nil:NilClass mean that you're expecting something
to be an object, but it's really nil. With something this short, it's
probably not so much *this* code, as whatever call it (or causes it to
be called, whatever). If you don't know what calls it, perhaps you
can insert something that would look for a nil value and dump the call
stack in that case. (Sorry I can't be more specific, as I don't know
CanCan myself; this is just a general code troubleshooting technique.)

-Dave