Forum: Ruby on Rails Getting "object references itself" error trying to execute @

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Acb53571e772fd106bbacc75b6340565?d=identicon&s=25 michael m (Guest)
on 2007-07-13 20:47
(Received via mailing list)
I have a class named "Event" and am trying to get values out to pass
into a javascript method.  If I use,

<%= @evt.attributes.to_json %>

I get the error message "object references itself".  For debugging
I've tried the same call in the body tags of the template and get the
same result (even when I remove all references to the javascript).
When I simply use <%= @evt.to_json %> I get the following.

{attributes: {start_date: "2007-07-11", city: "Spokane", addr1: "",
name: "Bobdogs Wide World of MA", latitude: "47.5", category: null,
zip: "", addr2: "", url: "", contact_phone: "", country: "",
hosting_studio: null, id: "1", description: null, contact_email:
"", longitude: "-122.6", num_days: "1", end_time: null,
start_time: null, contact_name: "Bobdog", state: "WA"}}

Pretty much at a loss, I've successfully used the same code for
another object but for the life of me can't figure out why it won't
work with my Event object.  I "Event" a bad name for an object?
Reserved word?  I tried renaming some of the objects attributes, but
still no luck.

Any help would be greatly appreciated!!
This topic is locked and can not be replied to.