activeadmin / inherited_resources

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Instead of actual destroying a object, updating a column attribute.

shrimanwar92 opened this issue · comments

I am using inherited resource for my project. I want to override default destroy action. But destroy! actually deletes the resource. What i want is just to update a column to that resource. Something like:

def destroy
  @user = User.find(params[:id])
  @user.update_column(:status, 0)
  redirect_to root_path
end

Any help is appreciated.

Pretty sure you just answered your own question 😉 The code you included should do the trick.