Hi --

On Fri, 3 Mar 2006, Charlie Bowman wrote:

>> I wrote:
>>>
>>> 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.
> I think that is the best answer so far....but that seems to go against
> everything that makes ruby so great.

That doesn't say much for all the other answers :-)

> Something just doesn't feel right about creating an object just to
> say that it's empty.  I guess I should ask this on the rails list,
> but I like this list much better :) , Is is possible to add methods
> to the nil class in only the views?  If so, that would be awsome!

I suppose you could engineer a way to do that, but it sounds awfully
fragile, and like an awful lot of trouble to go to.  I'd rather
normalize the data to an array (or whatever) and then just let each
array take care of itself.


David

-- 
David A. Black (dblack / wobblini.net)
Ruby Power and Light (http://www.rubypowerandlight.com)

"Ruby for Rails" chapters now available
from Manning Early Access Program! http://www.manning.com/books/black