Syntax error

I’m certain this is a stupid mistake but I can’t find it.

Can someone tell me why this code is giving me errors?

http://pastie.caboo.se/188590

The errors are at the botttom of the paste.

Thanks for any help.

at line 10 - 11, is not hash type. Here is your correction :

results.each_hash do |row|

if row[“start_time”].nil?
row[“start_time”] = “09:00:00”
end

if row[“end_time”].nil?
row[“end_time”] = “17:00:00”
end

event = { :title=>row["title"],
:startTime=>row["start_time"],
:endTime=>row["end_time"]}

 puts "Title of event #{row["start_time"]}

end

Good Luck,
reinhart

Http://teapoci.blogspot.com
“Object Oriented Antioxide”

Thanks for everyone help with this.

I see what you mean now, the corrections worked.

There was no earthly reason why the replacement needed to be in the
hash definition and moving it outside it makes perfect sense and
works.

Thanks everyone

Hi –

On Tue, 29 Apr 2008, Visit Indonesia 2008 wrote:

row[“end_time”] = “17:00:00”
end

Or even:

row[“start_time”] ||= “09:00:00”
row[“end_time”] ||= “17:00:00”

David


Rails training from David A. Black and Ruby Power and Light:
INTRO TO RAILS June 9-12 Berlin
ADVANCING WITH RAILS June 16-19 Berlin
INTRO TO RAILS June 24-27 London (Skills Matter)
See http://www.rubypal.com for details and updates!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs