Don't blame yourself too much. I helped a friend debug his Rails program the other day. He was taking one of the tutorials in the Rails book, and the first item of a particular type he added to the shopping cart was producing a bizarre JavaScript error. It turned out the problem section of code was just this:
by Daniel Lyons — Dec 24
@items << Product.new(id, 1)
@current_item = Product.new(id, 1)
Upon changing that to this, it just worked:
@current_item = Product.new(id, 1)
@items << @current_item
It was one of the more bizarre and hard to track down errors I've ever seen.