I am preparing an AJAX call and have a few boostrap-slider inputs for variables that correspond to rails Enum variables. I have two questions related this:
Thank you.
The answer to the first question is about finding the exact Rails map and link it to a JS variable. My code to do that required a few other methods but here it is.
var QUALITY = <%= Product::QUALITIES.invert.to_json.html_safe %>
In an ajax call, rails expects the enum rather than the integer. I used the function about to map the integer back to the enum value and submitted that.