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
Post a Comment