link_to_remote in Rails 5

0

I'm leaving for Rails 5 and I can not find a replacement for link_to_remote that has been discontinued.

In my old code, I have a "Cadastro" link, which when clicked, makes a request to the "register" action and renders the return in the above form "div".

Here are the basics of my view:

<%= javascript_include_tag :defaults %>

<div id="form">
</div>

<%= link_to_remote "Cadastro", :update => "form", 
      :url => { :action => "register" } %>
    
asked by anonymous 10.10.2017 / 01:17

1 answer

0

In rails 5, to perform an AJAX request, you must use remote: true

The result according to your code looks something like this:

<%= link_to "Cadastro", action: "register", remote: true %>

According to the rails 5 documentation:

Ifyouwouldlikemoreinformation: helper documentation link ' link_to '

    
11.10.2017 / 14:53