On 15 February 2011 18:26, Paul Bergstrom <li...@ruby-forum.com> wrote: > Kedar Mhaswade wrote in post #981823: >> Or since only keys are needed, use each_key iterator. >> >> Also, I think ri should say that the "method" each "returns" the same >> Hash >> on which you called the method. >> >> -Kedar > > I actually need both. > > Hmm. This should output a string in view but it doesn't: > > <% h = { "a" => 100, "b" => 200 } %> > <%= h.each {|key, value| puts "#{key} is #{value}" } %>
Just in case it is not clear from the other replies, when you execute puts when running as a rails app the output will go to the server terminal window, that is the terminal where you typed rails server. If you look there you will probably see it mixed up with all the server stuff. Colin -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.