jeudi 21 janvier 2016

Rails 4 : Table Boolean Column Update Using "link_to "with a specific value "TRUE" always

In my customer controller the update method code is like bellow:

  def update
    @customer= Customer.find(params[:id])
    if @customer.update_attributes(customer_params)
      redirect_to  customers_path
    else
      render 'edit'
    end
  end

In my view in customers index page I am planning to add a "link_to" link, if it is clicked, then that particular customers field "doc_delete" should be updated with value "TRUE".

<td><%= link_to "[Update", *************what is here ?******** method: :put %></td>

Aucun commentaire:

Enregistrer un commentaire