Google Maps integration with JSON - CircularReferenceError
- by JZ
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!