title: to_json give "nil is not a symbol", but object is not nil
body: <p>I'm receiving a strange error here. I generate some random data and insert into an array, as you can see below:</p>
  
  <pre><code>@all_stores = []
  for i in 0..10
    item = Item.new(
        :name =&gt; generate_random_product(), 
        :description =&gt; generate_random_product(),
        :url =&gt; generate_random_product(),
        :image_url =&gt; generate_random_product(),
        :type =&gt; "Goods",
        :category =&gt; "Electronics"
      )
    @all_stores &lt;&lt; item
  end
  
  write_to_file()
  </code></pre>
  
  <p>After that, I call a method to save this array of items to a file, like following:</p>
  
  <pre><code>def write_to_file()
     items_to_json()
  end
  
  def items_to_json()
     File.open("public/data.json", "w") { |f| f.write(@all_stores.to_json)}
     puts "Saved at 'public/data.json'"
  end
  </code></pre>
  
  <p>Running that, I receive the following error:</p>
  
  <pre><code>rake aborted!
  nil is not a symbol
  /home/paladini/.rvm/gems/ruby-2.0.0-p353@global/gems/activemodel-4.0.2/lib/active_model/serialization.rb:108:in `block in serializable_hash'
  /home/paladini/.rvm/gems/ruby-2.0.0-p353@global/gems/activemodel-4.0.2/lib/active_model/serialization.rb:108:in `each'
  /home/paladini/.rvm/gems/ruby-2.0.0-p353@global/gems/activemodel-4.0.2/lib/active_model/serialization.rb:108:in `serializable_hash'
  /home/paladini/.rvm/gems/ruby-2.0.0-p353@global/gems/activerecord-4.0.2/lib/active_record/serialization.rb:17:in `serializable_hash'
  /home/paladini/.rvm/gems/ruby-2.0.0-p353@global/gems/activemodel-4.0.2/lib/active_model/serializers/json.rb:99:in `as_json'
  /home/paladini/.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/json/encoding.rb:58:in `block in as_json'
  /home/paladini/.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/json/encoding.rb:81:in `check_for_circular_references'
  /home/paladini/.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/json/encoding.rb:57:in `as_json'
  /home/paladini/.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/json/encoding.rb:270:in `block in as_json'
  /home/paladini/.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/json/encoding.rb:270:in `map'
  /home/paladini/.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/json/encoding.rb:270:in `as_json'
  /home/paladini/.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/json/encoding.rb:50:in `block in encode'
  /home/paladini/.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/json/encoding.rb:81:in `check_for_circular_references'
  /home/paladini/.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/json/encoding.rb:49:in `encode'
  /home/paladini/.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/json/encoding.rb:34:in `encode'
  /home/paladini/.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/core_ext/object/to_json.rb:16:in `to_json'
  /home/paladini/Documents/Projetos/bittle/parse_usebitcoins/lib/tasks/data.rake:402:in `block in to_json'
  /home/paladini/Documents/Projetos/bittle/parse_usebitcoins/lib/tasks/data.rake:402:in `open'
  /home/paladini/Documents/Projetos/bittle/parse_usebitcoins/lib/tasks/data.rake:402:in `to_json'
  /home/paladini/Documents/Projetos/bittle/parse_usebitcoins/lib/tasks/data.rake:383:in `write_to_file'
  /home/paladini/Documents/Projetos/bittle/parse_usebitcoins/lib/tasks/data.rake:32:in `block (2 levels) in &lt;top (required)&gt;'
  Tasks: TOP =&gt; data:fast_test
  (See full trace by running task with --trace)
  </code></pre>
  
  <p>Finally, if I change the <code>items_to_json</code> method to the one below, it works.</p>
  
  <pre><code>def items_to_json()
     File.open("public/data.json", "w") { |f| f.write(@all_stores.inspect)}
     puts "Saved at 'public/data.json'"
  end
  </code></pre>
  
  <p>So I have in <code>data.json</code>:</p>
  
  <pre><code>[#&lt;Item name: "iRyqyHaMYtGrHTe", description: "SnCXDCMcasmIdrL", url: "GoEyRKsxfGeNuJC", type: "Goods", category: "Electronics", image_url: "fgjcXCTCcpLbLuq"&gt;, #&lt;Item name: "DEhnKIsxdMMeMpE", description: "YFDybXOekEMnzGE", url: "CwcMZTcuDfraPFd", type: "Goods", category: "Electronics", image_url: "lYzoirDTGObjdip"&gt;, #&lt;Item name: "kxVosdEszPnRAuT", description: "XWkLdKwXoByeibN", url: "psNbXlgqAquFEnL", type: "Goods", category: "Electronics", image_url: "hSVirvVIEvXjpNc"&gt;, #&lt;Item name: "XXboCYXaiOFuZlm", description: "SXiWoebtSgBJQiF", url: "ZNnTfdeqDoChRdW", type: "Goods", category: "Electronics", image_url: "QIWxWlqaosTtcYK"&gt;, #&lt;Item name: "kDHyIJvaZsCgbPt", description: "DoRHJplzfubidlh", url: "NmLqFabhxyqDLci", type: "Goods", category: "Electronics", image_url: "uMqzgLOywOQIVpg"&gt;, #&lt;Item name: "QDLaYGbTwnkqyWt", description: "HMzKmUxoLdFwEcL", url: "cTZzHSVQtAPWeqL", type: "Goods", category: "Electronics", image_url: "CcbMFwTaMUNSImt"&gt;, #&lt;Item name: "oLHowKZBlJdBDCo", description: "yDeXEYSiusbUlsN", url: "gXRDgTnQMTkYhuD", type: "Goods", category: "Electronics", image_url: "vYOiHDlgbVSdwgM"&gt;, #&lt;Item name: "biwsysSbECbktdb", description: "eLFfUBTAPFUYEcl", url: "hDDfCFhwiVmbtqR", type: "Goods", category: "Electronics", image_url: "HrpWUYFgpGYThSm"&gt;, #&lt;Item name: "BsHGxVsjlXxPPvQ", description: "oHkkqmFUqcCzGAc", url: "jetgofPYmnOARzy", type: "Goods", category: "Electronics", image_url: "SZWwCAKfIBMrKQi"&gt;, #&lt;Item name: "UCPqMLIVhQnGBYR", description: "qwuApfmBHEJPuin", url: "QEhSCKnIJciBSnd", type: "Goods", category: "Electronics", image_url: "SWIlGqPRHABZIaX"&gt;, #&lt;Item name: "TLpeNBzZcrEClRu", description: "olABsfHfNiIcaok", url: "fsiYMWbImrRNfnt", type: "Goods", category: "Electronics", image_url: "RgzZaFxFJgMangz"&gt;]
  </code></pre>
  
  <p>If the <code>@all_stores</code> isn't nil, why this method is giving me that? How can I solve this error?</p>