Possibility of Accessing Ruby Objects in form.js bypassing form.yml.erb

Just a quick question, and is related to Ruby objects into JavaScript . I am a student under Martin, and we were wondering if there is a possibility to embed Ruby Objects into the form.js, without using form.yml.erb as a mediator with the HTML.

Any thoughts on whether this is viable?

No, those javascript files don’t pass through ERB rendering.

We traditionally use HTML data attributes to pass information from the server to the client.

What’s the goal you’re trying to achieve?

Hi Jeff, we want to pass a static key-value pair structure that contains mapping of GPU type and its description, e.g. (“1080ti”,“Nvidia GeForce 1080Ti”) to show in the pull down for a choice of GPU. We had it originally in the form.js as a Javascript object, but, I’d prefer it to be editable at a single location, so our thought is to have it in a text file, read in the ood.rb, and then through the form.yml.erb data inject into the form.js.

Would that be what you refer to as the HTML data?

I don’t think so. Or at least I don’t think there’s a way to do what you want - inject into javascript. You can have javascript read data of the HTML page, but I don’t think there’s a clean way in 3.1 to go the other way.