How I can integrate ruby variable into a js file. I would like to render a partial relative to the current step of registration of my User. But I can't succeed it, Rails do not translate @flat.current_step in his value (which is a integer). Any ideas ?
$('.flats').replaceWith("<%= j render partial: 'flats/steps/step#{@flat.current_step}' %>");
Error
ActionView::Template::Error (Missing partial flats/steps/_step#{@flat.current_step}