Ruby on Rails Friday, August 3, 2012

saw something similar somewhere as a test for job seekers :)

so don't know if someone will help you as it's not so hard to solve

tom

On Aug 1, 2012, at 15:25 , Esmerino Costa <hakagura@gmail.com> wrote:

> I have a hash like so:
>
> list=[
> {:cod => "0001", :name => "name1", :val => 10},
> {:cod => "0001", :name => "name1", :val => 12},
> {:cod => "0002", :name => "name2", :val => 13},
> {:cod => "0002", :name => "name2", :val => 14},
> {:cod => "0002", :name => "name2", :val => 14},
> {:cod => "0004", :name => "name4", :val => 16},
> {:cod => "0004", :name => "name4", :val => 16},
> {:cod => "0004", :name => "name4", :val => 17},
> {:cod => "0005", :name => "name5", :val => 17},
> {:cod => "0005", :name => "name5", :val => 17},
> {:cod => "0005", :name => "name5", :val => 17},
> {:cod => "0006", :name => "name6", :val => 110},
> {:cod => "0006", :name => "name6", :val => 10},
> ]
> What I would like to learn how to do is how to remove a record if it is duplicate end sum values :val.
>
>
> --
> 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+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/SJr0rc22ScgJ.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
===============================================================================
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz
===============================================================================

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment