[Rails] Re: Delete duplicate records from a 2 dimensional array in rails

2013-11-19 Thread Sergei Barilov
Joel Pearson wrote in post #1121051: > uniq can take a block as well if you wanted to unique similar arrays on > a specific element: > > @mem.uniq { |mem| mem[1] } > > Or even on multiple criteria: > > @mem.uniq { |mem| [ mem[1], mem[2] ] } This was very helpful Thank you -- Posted via http://

[Rails] Re: Delete duplicate records from a 2 dimensional array in rails

2013-09-09 Thread Joel Pearson
uniq can take a block as well if you wanted to unique similar arrays on a specific element: @mem.uniq { |mem| mem[1] } Or even on multiple criteria: @mem.uniq { |mem| [ mem[1], mem[2] ] } -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to th

[Rails] Re: Delete duplicate records from a 2 dimensional array in rails

2013-09-09 Thread Max
if you really need to do some processing that gets you an array with duplicate entries and then clean the array at the end of it all. try doing something like @mem = @mem.uniq you can probably do @mem.uniq! but i've had some cases where that didn't get me the results i wanted. -- You recei