Skip to content

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

@asfarley

Description

@asfarley

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions