From: Robert Klemme Date: 2013-06-30T01:58:40+09:00 Subject: Re: Find elment in array of hashes --001a11c2e68e24589004e04de880 Content-Type: text/plain; charset=ISO-8859-1 On Sat, Jun 29, 2013 at 6:05 PM, Rodrigo Lueneberg wrote: > Thanks, > > Just to conclude my approach. > > hash symbol did not work with select_all method > results = @selectedProductsArray.find {|hash| hash[:id] == 3 } > > This worked: > results = @selectedProductsArray.find {|hash| hash["id"] == 3 } > Nobody will be able to understand your conclusion in absence of the real code you used to create the Array - if you created an array. Good luck! robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/ --001a11c2e68e24589004e04de880 Content-Type: text/html; charset=ISO-8859-1



On Sat, Jun 29, 2013 at 6:05 PM, Rodrigo Lueneberg <lists@ruby-forum.com> wrote:
Thanks,

Just to conclude my approach.

hash symbol did not work with select_all method
results = @selectedProductsArray.find {|hash| hash[:id] == 3 }

This worked:
results = @selectedProductsArray.find {|hash| hash["id"] == 3 }

Nobody will be able to understand your conclusion in absence of the real code you used to create the Array - if you created an array.

Good luck!

robert

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
--001a11c2e68e24589004e04de880--