ruby on rails - What would the equivalent button_to call of this link_to usage be? -


i have link_to call works expected:

<%= link_to "freeze", url_for([user, status: :frozen]), method: :put %> # generates: <a href="/users/1?status=frozen" rel="nofollow" data-method="put">freeze</a> 

but i've read should instead use button_to updating resources because generates important-looking "authenticity_token" , defaults post method.

how write button_to call functions same above link_to?

here way:

<%=    button_to(     "freeze",     user,     method: :put,     params: { status: :frozen }   ) %> 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -