On Mar 2, 2006, at 1:06 PM, dblack / wobblini.net wrote:

> Hi --
>
> On Fri, 3 Mar 2006, Charlie Bowman wrote:
>
>> The only time this nil problem occurs for me is with rails views.   
>> With
>> all other ruby (about half my time is spent in ruby and the other  
>> half
>> web apps) code, I never have the nil problem unless I've written bad
>> code.  I feel like web templates should not throw errors if you  
>> pass nil
>> values.
>
> Probably the best thing is to do whatever's necessary in the
> controller to make sure the template can coast.  So you could, for
> example, put list.items (or whatever) in @items, making sure in
> advance that it's an empty array if there aren't any.

Bingo.  I think that's the perfect answer here.

Remember that you can always declare Helper methods that deal with  
the nils for you too.

James Edward Gray II