[Rails] Looping through hash and sub-hash.

2013-06-19 Thread Patrick Curl
# Need a little push in the right direction. @prices = [ amazon_new = [ image = imageurl.com, url = bookurl.com, price = 45.55 ], amazon_used = [ image = 2ndImageUrl.com, url = 2ndbookurl.com,

Re: [Rails] Looping through hash and sub-hash.

2013-06-19 Thread Jim Ruther Nill
On Thu, Jun 20, 2013 at 10:30 AM, Patrick Curl patrickwc...@gmail.comwrote: # Need a little push in the right direction. @prices = [ amazon_new = [ image = imageurl.com, url = bookurl.com, price = 45.55 ], amazon_used = [

Re: [Rails] Looping through hash and sub-hash.

2013-06-19 Thread Jeffrey Jones
You are mixing up arrays and hashes. Below is an all hash example. @prices = { amazon_new = { image = imageurl.com, url = bookurl.com, price = 45.55 }, amazon_used = { image = 2ndImageUrl.com, url = 2ndbookurl.com, price = 67.45 } } @prices.each_pair do |type,