gon icon indicating copy to clipboard operation
gon copied to clipboard

Why do my objects only contain ID strings after transmitting via gon?

Open asfarley opened this issue 4 years ago • 2 comments

I'm having a strange problem: previously, the gon gem was working for me to pass an array of objects to the browser. Here's the assignment:

gon.frames = @job.sequence.frames.sort_by(&:n)

Previously, this assignment resulted in the gon.frames variable containing a list of Javascript dictionaries/objects:

{id: 11, user_id: 12, sequence_id: 13, sequence_list_id: 3, complete: false, …}

Now, it contains only an ActiveRecord ID or something like that:

"#<Frame:0x00007f25035e47d0>"

I've made some changes in my code, mainly running bundle update and things like that, but nothing that would intentionally change how this work. However, there was a wide enough set of changes from updating the gems that it's hard to isolate the source of this change.

Is gon responsible for deciding how to convert something into Javascript? What would cause gon to convert into the format that only includes an identifier, rather than the dictionary of values?

asfarley avatar Jan 25 '21 19:01 asfarley

Am I understanding the CI test results correctly? It looks like this gem isn't passing for any rubies beyond 2.4.10

asfarley avatar Jan 25 '21 20:01 asfarley

Not sure what was happening here, but I rolled back to ruby 2.6.1 and it seemed to fix my problems.

asfarley avatar Jan 25 '21 21:01 asfarley