title: Two if statements in the update controller
body: <p>I have a controller with update method. </p>
  
  <pre><code>def update
   @student = Student.find(params[:student_id])
   @lesson = @student.lessons.find(params[:id])
  
   @lesson.update_attributes(lesson_params)
   redirect_to @lesson.student, notice: "Les updated"
  end
  </code></pre>
  
  <p>That works just fine!. 
  I want to add new if statement that change the :paid params from false to true. so I put it like this</p>
  
  <pre><code> def update
      @student = Student.find(params[:student_id])
      @lesson = @student.lessons.find(params[:id])
  
      @lesson.update_attributes(lesson_params)
      redirect_to @lesson.student, notice: "Les updated"
  
      if @lesson.paid == nil
        @lesson.paid = true
        @lesson.save
        redirect_to @lesson.student, notice:"Les is betaald!"
      end
    end
  </code></pre>
  
  <p>When I click the button in the view to change the :paid param I get this error</p>
  
  <pre><code>param is missing or the value is empty: lesson
  </code></pre>
  
  <p>If I make it like this</p>
  
  <pre><code>def update
   if @lesson.paid == nil
     @lesson.paid = true
     @lesson.save
     redirect_to @lesson.student, notice:"Les is betaald!"
   end
  end
  </code></pre>
  
  <p>It works fine!
  So for now, it looks like that I can use only one if statement!
  I tried to use elsif, but it doesn't help!</p>
  
  <p>The params</p>
  
  <pre><code>private
    def lesson_params
      params.require(:lesson).permit(:date, :time, :paid)
    end
  </code></pre>
  
  <p>The code of the view to update :paid params</p>
  
  <pre><code>&lt;% if les.paid === nil %&gt;
     &lt;td&gt;&lt;%= link_to "Niet betaald", [@student, les, paid: true], method: :put, class: "niet-betaald" %&gt;
     &lt;/td&gt;
      &lt;% else %&gt;
     &lt;td style="color:lightgrey;"&gt;Betaald&lt;/td&gt;
   &lt;% end %&gt;
  </code></pre>