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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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" -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi -- On Tue, 29 Apr 2008, Visit Indonesia 2008 wrote:> > 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" > endOr 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! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---