LinkedInからハッシュを解析しようとしていますが、エラーが発生します
これが私が解析しようとしているハッシュ(マッシュから変換された)です:
#<LinkedIn::Mash first_name="John" headline="Recruiter" id="xxxxxxxx" industry="Telecommunications" last_name="Smith" location=#<LinkedIn::Mash country=#<LinkedIn::Mash code="us"> name="Greater Philadelphia Area"> positions=#<LinkedIn::Mash all=[#<LinkedIn::Mash company=#<LinkedIn::Mash id=2325416 industry="Staffing and Recruiting" name="Amazing Associates, Inc" size="1-10 employees" type="Privately Held"> id=9999999 is_current=true start_date=#<LinkedIn::Mash month=6 year=2010> summary="" title="Corporate Recruiter">] total=1> public_profile_url="http://www.linkedin.com/pub/greatguyjohn">
これが私が持っているコードです:
<% if !connection["positions"].nil? %>
<% connection["positions"].each do |positions| %>
<% if !positions["all"].nil? %>
<% positions["all"].each do |company| %>
<%= company %>
<% end %>
<% end %>
<% end %>
<% end %>
エラーは次のとおりです。
can't convert String into Integer
Extracted source (around line #15):
12: <% if !connection["positions"].nil? %>
13: <% connection["positions"].each do |positions| %>
14: <% if !positions["all"].nil? %>
15: <% positions["all"].each do |company| %>
16: <%= company %>
17: <% end %>
問題は、["positions"]ハッシュから["all"]ハッシュを解析しているようです。残りのハッシュは正常に解析されますが、このエラーが発生し続けます。