views:

12

answers:

1

I try to serialize an instance of my ActiveRecord model to JSON (using "render :json => @entities" or "@entities.to_json"), but I always get an CircularReferenceError ("ActiveSupport::JSON::Encoding::CircularReferenceError (object references itself)"). This only happens when the ActiveRecord instances are queried by using ThinkingSphinx. The to_xml serialization works fine. Is that a known problem? I am using the latest Rails 3 and ThinkingSphinx.

A: 

"render :json => @entities.to_a" works around that problem.

Zardoz