ActiveSupport::JSON::CircularReferenceError in InvoiceContro

Hello again,

I’m trying to use a grid control from EXTjs with RoR, and I’m following
some exampe I found on the web, and adapting to my test database …

I can’t see any row, the grid is only a poor line, I use other extjs in
the same page, and they are ok.

Trying to debuging, I found that the error, or at least one error, is
when I apply the json …

Here’s the code:

If I comment the last line: render :text=>return_data.to_json,
:layout=>false I don’t get any error.

Any clue of what’s wrong ?

thanks,

raimon

     return_data = Hash.new()
     return_data[:Total] = @invoice_pages.item_count
     return_data[:Movies] = @invoices.collect{|u| {:id=>u.id,
                                         :factura=>u.factura,
                                         :data=>u.data,
                                         :client=>u.tipus,
                                         :total_base=>u.total_base,
                                         :total_iva=>u.total_iva,
                                         :total=>u.total} }
    render :text=>return_data.to_json, :layout=>false

On 04 Dec 2007, at 18:17, Raimon Fs wrote:

Here’s the code:

If I comment the last line: render :text=>return_data.to_json,
:layout=>false I don’t get any error.

Any clue of what’s wrong ?

You’ll probably have dates in your data to output as json. It doesn’t
always work in Rails 1.2.x (don’t know about Edge). You could look
into jsonifier, iirc this plugin fixes these kind of problems.

Best regards

Peter De Berdt

Peter De Berdt wrote:

On 04 Dec 2007, at 18:17, Raimon Fs wrote:

Here’s the code:

If I comment the last line: render :text=>return_data.to_json,
:layout=>false I don’t get any error.

Any clue of what’s wrong ?

You’ll probably have dates in your data to output as json. It doesn’t
always work in Rails 1.2.x (don’t know about Edge). You could look
into jsonifier, iirc this plugin fixes these kind of problems.

Best regards

Peter De Berdt

yes, it was a date problem as you suggests …

I see that I have some more bugs in my ext grid …

thanks for your info !

regards,

rai