Lets say I have this data :
[{"sku"=>"reprint"}, [], nil, {"quantity"=>"1"}, [], nil, {"shippingOptions"=>"PQRS"},
[{"option"=>"PQRS"}], nil, {"abc"=>"abcccc"},
[], nil,{"sku"=>"poster"},
[], nil, {"quantity"=>"2"}, [], nil, {"shippingOptions"=>"MNLIJK"},
[{"option"=>"MNL"}, {"option"=>"IJK"}], nil, {"sku"=>"cards"},
[], nil, {"quantity"=>"5"},
[], nil, {"shippingOptions"=>"DEFABC"}, [{"option"=>"DEF"}, {"option"=>"ABC"}], nil]
I want to iterate this data and print it in html in a proper format using Ruby on Rails
I’m new to this technology. Any help is appreciated!
.flattenmight be handy here. If you’re not fussed about the structure, I’d just flatten it before iterating then you don’t have to worry about varying depth.RE: comments.
produces:
=> {"sku"=>["reprint", "poster", "cards"], "quantity"=>["1", "2", "5"], "shippingOptions"=>["PQRS", "MNLIJK", "DEFABC"], "option"=>["PQRS", "MNL", "IJK", "DEF", "ABC"], "abc"=>["abcccc"]}I actually want my new data to be some what like this :