# Getting "object references itself" error trying to execute @

**URL:** <https://www.ruby-forum.com/t/getting-object-references-itself-error-trying-to-execute/109371>\
**Category:** Rails\
**Created:** [July 13, 2007, 8:47pm UTC](https://www.ruby-forum.com/t/getting-object-references-itself-error-trying-to-execute/109371 "2007-07-13T20:47:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 13, 2007, 8:47pm UTC](https://www.ruby-forum.com/t/getting-object-references-itself-error-trying-to-execute/109371/1 "2007-07-13T20:47:26Z")

</div>

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:  
“removed\_email\_address@domain.invalid”, 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!!
