Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #7265
| Newsgroups | comp.lang.ruby |
|---|---|
| Date | 2016-06-25 03:47 -0700 |
| References | <f0940c4f-7a05-47b1-8fb9-44b0537f69ad@googlegroups.com> <dt73veFbbbkU1@mid.individual.net> |
| Message-ID | <13873e93-3db4-47b8-83ad-35fa19e6d70f@googlegroups.com> (permalink) |
| Subject | Re: Best way to create hash of hashes |
| From | Sayth Renshaw <flebber.crue@gmail.com> |
> This is not a valid representation of a Hash. Which of these do you want?
>
> irb(main):001:0> { 'Id:123' => [{id:1, name:'John'}, {id:2, name:'Sarah'}]}
> => {"Id:123"=>[{:id=>1, :name=>"John"}, {:id=>2, :name=>"Sarah"}]}
>
> irb(main):002:0> { Id:123, members: [{id:1, name:'John'}, {id:2,
> name:'Sarah'}]}
> => {:Id=>123, :members=>[{:id=>1, :name=>"John"}, {:id=>2, :name=>"Sarah"}]}
>
> ...
>
> > So that I am saying Sarah and John are members of group id: 123.
>
> That depends on your input and how you access it.
>
> Kind regards
>
> robert
>
>
> --
> remember.guy do |as, often| as.you_can - without end
> http://blog.rubybestpractices.com/
Is there a particular benefit of one over the other? I want to be able to keep the relation between ids and descendant nodes and then put this into a database, is one more suitable than the other?
Thanks
Sayth
Back to comp.lang.ruby | Previous | Next — Previous in thread | Next in thread | Find similar
Best way to create hash of hashes Sayth Renshaw <flebber.crue@gmail.com> - 2016-06-24 18:50 -0700
Re: Best way to create hash of hashes Robert Klemme <shortcutter@googlemail.com> - 2016-06-25 12:16 +0200
Re: Best way to create hash of hashes Sayth Renshaw <flebber.crue@gmail.com> - 2016-06-25 03:47 -0700
Re: Best way to create hash of hashes Robert Klemme <shortcutter@googlemail.com> - 2016-06-25 14:19 +0200
Re: Best way to create hash of hashes Sayth Renshaw <flebber.crue@gmail.com> - 2016-06-25 08:27 -0700
Re: Best way to create hash of hashes Robert Klemme <shortcutter@googlemail.com> - 2016-06-26 00:26 +0200
csiph-web