lundi 18 juillet 2016

Change checkbox to change in db in rails?

I have a table "User" with "admin" is "true" or "false". I show it with checkbox_feild. How can i change db if i click in checkbox if i don't use ajax? Thanks all.

<% @users.each do |user| %>
  <%= form_for user, do |f| %>
  <div class="field">
    <%= f.check_box :admin%>
  </div>
 <% end %>
<% end %>




Aucun commentaire:

Enregistrer un commentaire