mercredi 12 avril 2017

Ajax calls with Rails 5 using remote_function

I am trying to upgrading a 2.3.2 rails application to rails 5, i know that no more remote_function in rails 3,4,5. how can i fix the bug using Ajax this is the code:

<p><label for="medium">Medium: </label><%= collection_select(:order_item, :medium_id, @media,  :id, :label, { :always_prompt => "Select a medium" }, { :onchange => "#{remote_function(:url => { :action => "medium_changed" }, :with => "'order_item_id=#{@order_item.id}&order_id=#{@order_item.order.id}&medium_id='+value") }", :id => "order_item_medium_id", :name => "order_item[medium_id]" ,:class=>"form-control"} )  %></p>

Aucun commentaire:

Enregistrer un commentaire