7stud2
(7stud --)
21
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 }
Rod
···
--
Posted via http://www.ruby-forum.com/.
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
···
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 }
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
stomar
(stomar)
23
Of course, when your actual hashes use strings as keys,
and not symbols like in the example you gave earlier.
Regards,
Marcus
···
Am 29.06.2013 18:05, schrieb Rodrigo Lueneberg:
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 }
--
<https://github.com/stomar/>