This project is archived and is in readonly mode.

#6564 ✓duplicate
Chris Oliver

undefined method `zero?' for #<OrderedHash {}>

Reported by Chris Oliver | March 11th, 2011 @ 07:01 PM | in 3.0.6

I'm working on a small application for class, and get the following bug Rails 3.0.4 and 3.0.5:

@tours = Tour.where(["date = ?", @date]) \
             .order("date ASC, time ASC") \
             .joins("LEFT JOIN visitors ON tours.id = visitors.tour_id") \
             .group("tours.id") \
             .select("tours.*, COALESCE(SUM(visitors.total_party), 0) as current")

# puts @tours # This will fix the issue
@tours.empty?

undefined method `zero?' for #2, 26=>1}> happens when I call @tours.empty?. If I do anything like print out @tours or access it in any other way, empty? exists then and it will work fine.

I imagine it's a simple fix in ActiveRecord, but I don't know where to look in order to patch it myself.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages