Topic: Undefined method for hash

I can't figure out what's wrong with this code snippet. I get undefined method `start_time' for #<Hash:0x00000004d05be8>

@availability_grid << { :venue_id => venue_id, :start_time => next_start_time, :end_time => next_end_time }


    @availability_grid.each do |grid|

      if grid.start_time != start_time

         start_time = grid.start_time

      end

Re: Undefined method for hash

try:

@availability_grid.each do |grid|
      if grid[:start_time] != start_time
         start_time = grid[:start_time]
      end
end

instead (it's a hash, its attributes do not have accessor methods by default)

Re: Undefined method for hash

Thanks! That did the trick.