Sunny Bogawat wrote:
> Joshua Abbott wrote:
>> Would you mind posting an example of the hash and an example of how you 
>> would like it sorted?
>> 
>> Thanks,
>> Josh
>> http://iammrjoshua.com
> 
> 
> say i have album id 233 and created date 12/09/2008 so my key should be 
> 12092008_233 in this way?

Instead of concatenating a string, just make your key an array of the 
values.

hash = {}
key = [date, album_id]
hash[key] = value

However, hashes are not sorted in Ruby 1.8. Rails 2.x has an OrderedHash 
that maintains the keys' nsertion order, but it's not efficient for 
lookup by key. If you only plan to use the hash for iteration, that's 
probably OK (but then why use a hash?).
-- 
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to