title: How to update data for all users with a button on rails?
body: <p>I have my index view with some code :</p>
  
  <p>So i have my User model. Each user has a column "readyy". 
  If its = 0, so I display "Ready", = 1 "not ready", =2 "Unconfirmed"
  Each user can edit its own state, and admins can edit all users state one by one.</p>
  
  <p>But how can I display a button (only for admin with my "current_user.admin?" method) that set the readyy cell to 2 (to set all users "unconfirmed") for all users ? Like, all in the same time.
  NowI have to click one by one to set the readyy state to 2, it's not convenient.
  Here is my view erb :</p>
  
  <pre><code>&lt;% @user.each do |u| %&gt;
  
  &lt;div class="&lt;% if u.readyy == 2 %&gt;unconfirmed &lt;% end %&gt; &lt;% if u.readyy == 1 %&gt;ready&lt;% end %&gt; &lt;% if u.readyy == 0 %&gt; not_ready&lt;% end %&gt;"&gt;
  
  &lt;%= u.name %&gt;
  
  &lt;% if current_user %&gt;
  &lt;% if current_user.id == u.id || current_user.admin? %&gt;
  
  &lt;%= form_with(model: u) do |form| %&gt;
  
  
  &lt;%= form.submit 'UPDATE STATE' %&gt;
  
  &lt;% if current_user.admin? %&gt;
  
  &lt;%= form.select :readyy, @readyyy # @readyyy = {  unconfirmed: 2, ready: 1, not_ready: 0 } %&gt;
  
  &lt;% else %&gt;
  
  &lt;%= form.select :readyy, @readyy #@readyy = {  ready: 1, not_ready: 0 } %&gt;
  
  &lt;%end %&gt;
  
  &lt;%end %&gt;
  &lt;%end %&gt;
  &lt;%end %&gt;
  &lt;%end %&gt;
  </code></pre>