In view, I call the <%= escape_javascript render_statuses_select_box %> function, which in turn is defined in the helper. This function takes parameters from me. How does the value obtained in this way: $("#my_id").val() pass to this function?

  • Do you want to pass to the Ruby'shny method the value received via JS from the page on the client? So what? - D-side
  • @ D-side, yes, for this I do a POST request, where I pass the JS value, but I don’t know how to continue, this escape_javascript render_project_select_box method escape_javascript render_project_select_box in the controller does not work - S.Ivanov
  • 2
    Give a minimal example to reproduce what you are facing. So far two answers come to mind: (1) in any way, (2) to transfer this value in advance to the original request. - D-side
  • Or use the gem github.com/gazay/gon - Vetal4eg

1 answer 1

  1. Send js-variable to the server via AJAX.
  2. Assign @ variable on server
  3. <%= escape_javascript render_statuses_select_box %> done with unobtrusive javascript.