From: Alex Copot Date: 2006-06-05T20:39:45+09:00 Subject: Re: isset kinda function Thank you very much. Florian Groß wrote: > Alex Copot wrote: > >> You have a nil object when you didn't expect it! >> You might have expected an instance of Array. >> The error occured while evaluating nil.[] > > Seems like session[:cart] is nil. You can just do > > if session[:cart] then > ... > end > > And things will work correctly. > > What you proably want is to initialize session[:cart] to an object, > though. You can do that like: > > session[:cart] ||= default > > Hope this helps. -- Posted via http://www.ruby-forum.com/.