title: Update function Ruby
body: <p>I want this function, if the status of <strong>progress</strong> so that it changes on the <strong>done</strong> exactly at those IDs where the status is for the conditions, at the moment I get an error and secondly, if it worked without errors, then it would change everything, but I need if progress is finished and if you don’t, then on progress</p>
  <p>I selected three records through the form using a checkbox ...
  in the function, I want that if the status of the record from database is &quot;done&quot;, then it should change to &quot;progress&quot;, if the status is &quot;progress&quot; in the record, then it should be changed to &quot;done&quot;. Now I click on &quot;submit_tag&quot; and I get an error and in any case this code will not work the way I want it, I want everything to be conditional.</p>
  <p>I am completely in ruby, help please, maybe the problem is in the syntax</p>
  <pre><code>no implicit conversion from nil to integer
  
  
   def update_me
        @iteam = Iteam.find(params[:id])
        if @iteam[params[:status]] == 'progress' 
          Iteam.where(params[:id]).update_all(status: 'DONE')
        else
          Iteam.where(params[:id]).update_all(status: 'progress')
        end 
   end
  </code></pre>
  <p>index view</p>
  <pre><code>&lt;%= form_tag update_me_iteams_path, :method =&gt;'put' do %&gt;
  
  
      &lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;Title&lt;/th&gt;
          &lt;th&gt;Text&lt;/th&gt;
          &lt;th&gt;Status&lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
      &lt;/tr&gt;
  
      &lt;% @iteams.each do |iteam| %&gt;
          &lt;tr&gt;
          &lt;td&gt;&lt;%= iteam.id %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= iteam.title %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= iteam.text %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= iteam.status %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= link_to 'Show', iteam_path(iteam) %&gt;&lt;/td&gt;
          
          &lt;td&gt;
              &lt;%= check_box_tag &quot;id[]&quot;, iteam.id %&gt;
              
  
          &lt;/td&gt;
  
          &lt;/tr&gt;
      &lt;% end %&gt;
  
      
      &lt;/table&gt;
      
      &lt;%= submit_tag &quot;Edit Checked&quot; %&gt; 
  
    &lt;% end %&gt;  
  </code></pre>