Google Maps integration with JSON - CircularReferenceError

Posted by JZ on Stack Overflow See other posts from Stack Overflow or by JZ
Published on 2010-04-03T06:44:37Z Indexed on 2010/04/03 6:53 UTC
Read the original article Hit count: 306

Filed under:
|

I'm working on Rails 3.0.0.beta2, following Advanced Rails Recipes "Recipe #32, Mark locations on a Google Map" and I hit a road block.

The following code is returning a "ActiveSupport::JSON::Encoding::CircularReferenceError" "object references itself" at line 3. This code represents the /layouts/maps.html.erb file

<% if @maps -%>
<script type="text/javascript">
    var maps = <%= @maps.to_json %>;
</script>
<% end -%>

This is my first attempt at rendering JSON, and I don't know how to debug this problem. Do you have experience with this? What could cause this problem?

Thank you in advance!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about JSON