lundi 8 juillet 2019

How to use rails update method for multiple object with collection

I am trying to update multiple objects with rails update method with update collection object as following codes:(couldn't really find the collection method)

def update

      @reiew = Review.find(reivew_params)
       review.update!(reivew_params)

        if @reivews.update(reivew_params)
        respond_to do |format|
        format.html { redirect_to reivew_path}
      end
    else
        respond_to do |format|
        format.html { notice: 'saved errors'}
      end
    end
  end

Aucun commentaire:

Enregistrer un commentaire