Sorting hash by values
Posted on June 11, 2007 - Filed Under Ruby | 4 Comments
Sorting hash by values is quite straightforward. You don’t have to search long to find this example in Ruby documentation: h.sort {|a,b| a[1] <=> b[1]} sort method takes hash converts it in array of two elements arrays and then sort it as an array. When called without code block, sorts hash by keys. But when [...]
Popularity: 21% [?]
Read More..>>Proper RHTML tags for each loops
Posted on June 3, 2007 - Filed Under Ruby, RubyOnRails | Leave a Comment
Last night and this morning I have wasted few hours trying to move forward, over some stupid issue. I was parsing XML data with Hpricot, and since it was my first approach to problem, I was just dumping to output some fields from XML data. And here my frustration began. Since output from my views [...]
Popularity: 4% [?]
Read More..>> « go back

