nested_form icon indicating copy to clipboard operation
nested_form copied to clipboard

link_to_remove is not deleted vale only hide that so when we update that send hide value in parmeter

Open rohitmalik4 opened this issue 8 years ago • 1 comments

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

rohitmalik4 avatar Apr 01 '16 11:04 rohitmalik4

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

Mkunz89 avatar May 09 '17 22:05 Mkunz89