title: Update Multiple Records with a single command in Ruby
body: <p>Basically I want to update an array of objects that my api recieves in a single command. I have done it when I was inserting but I couldn't find a way to do update it.
  Here is m create method for multiple insertions:</p>
  
  <pre><code>def create_all
  
      if Attendance.create attendance_params
          render json: { message: "attendance added" }, status: :ok
      else
          render json: { message: "error in creation" }, status: :bad_request
      end
  end
  </code></pre>
  
  <p>Params:</p>
  
  <pre><code>def attendance_params
      params.require(:attendance).map do |p|
  
          p.permit(
              :student_id,
              :id,
              :attendance
          )
      end
  end
  </code></pre>
  
  <p>I tried to do similar thing with update but it generates this error:</p>
  
  <pre><code>   Completed 500 Internal Server Error in 11ms (ActiveRecord: 2.7ms) 
     Argument Error (When assigning attributes, you must pass a hash as an argument.)
  </code></pre>
  
  <p>my update method is this:</p>
  
  <pre><code>def update_attendance
      if Attendance.update attendance_params
          render json: { message: "attendance updated" }, status: :ok
      end
  end
  </code></pre>