I have this problem, where I keep on getting
TypeError: can't convert String into Integer
This is where I'm going through this @data object.
here is the @data object
@data = HTTParty.get("")
{
"body"=>{
"predictions"=>{
"direction"=>{
"prediction"=>[
{
"epochTime"=>"1362931090892",
},
{
"epochTime"=>"1362931747892",
},
{
"epochTime"=>"1362932467892",
},
{
"epochTime"=>"1362933187892",
},
{
"epochTime"=>"1362933847892",
}
],
"title"=>"xxxx"
},
"a"=>"xx",
"b"=>"x"
},
"name"=>"some"
}
}
and my code to go through above has been
<% if @data["body"]["predictions"].present? %>
<% @data["body"]["predictions"].each do |p| %>
<%p["direction"].each do |d|%>
<% d["prediction"].each do |k|%>
<h4><%= k["epchoTime.."] %> </h4>
<%end%>
<%end%>
<%end%>
<%end%>
I have no idea how to go through this, I assume this is due to the fact I should access stuff like I do in C++ with name[integer] value, but I would like to use ["name"]. How can I make my code work ?
Thanks for your precious time and consideration.