title: Ruby on Rails Twitter trends - TypeError = can't convert string into integer?
body: <p>I'm getting a really strange error message in my app. In my controller I have:</p>
  
  <pre><code>require 'open-uri'
  require 'json'
  class NoticiasController &lt; ApplicationController
    def index
      url = 'https://api.twitter.com/1/trends/daily.json'
      buffer = open(url, "UserAgent" =&gt; "Ruby-Wget").read
      # convert JSON data into a hash
      @result = JSON.parse(buffer)
      end
    end
  </code></pre>
  
  <p>and in the view I have</p>
  
  <pre><code>&lt;div&gt;
    &lt;% for news in @result['trends'] %&gt; 
    &lt;p&gt;&lt;%= news['name'] %&gt;&lt;/p&gt;
    &lt;% end %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>but I get "TypeError: can't convert String into Integer".</p>
  
  <p>What am I doing wrong?</p>