This project is archived and is in readonly mode.
to_json on ActiveRecord::Relation throws CircularReference Exception
Reported by blackgold9 | May 10th, 2010 @ 11:42 PM
In my controller I'm querying a table using an ActiveRecord
model and trying to return json.
When I attempt to call to_json on an ActiveRecord::Relation, I get
a circular reference exception. When I call to_a on the relation
and THEN call to_json, it works.
Code that fails:
Model.where().to_json
Code that works
Model.where().to_a.to_json
This is reproducable on the rails console.
Is this expected? It seems wrong/non-discoverable if it is.
Comments and changes to this ticket
-
Neeraj Singh May 11th, 2010 @ 06:13 PM
This is a duplicate of https://rails.lighthouseapp.com/projects/8994/tickets/4547-activesu... .
@blackgold Could you please provide more information about your model so that I could look into this issue. Please provide extra info on #4547 ticket.
Thanks
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>