link_to_remove is not deleted vale only hide that so when we update that send hide value in parmeter
rohitmalik4 opened this issue · 1 comments
rohitmalik4 commented
link_to_remove is not deleted vale only hide that so when we update that send hide value in parameter so my races is not updated,
So i want remove that value after click the Remove field.
Please help me
Mkunz89 commented
A quick and dirty solution for this, is to change your link_to_remove field to a basic link_to that points to your own method:
<%= f.fields_for :users ,do |user| %>
<%= user.text_field :first_name, :placeholder => 'First Name' %>
<%= user.text_field :last_name, :placeholder => 'Last Name' %>
<%= link_to "Remove", archive_user_path(user.object), :method => :post if user.object.id%>
<%end%>
class UsersController < ApplicationController
def archive
user = User.find(params[:id])
user.archived = true
user.save
respond_to do |format|
format.html { redirect_to :back}
end
end
end