Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

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

Open
rohitmalik4 opened this issue Apr 1, 2016 · 1 comment

Comments

@rohitmalik4
Copy link

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
Copy link

Mkunz89 commented May 9, 2017

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants