what's best proceed exercise gmail impression "undo" rails?
i cruise vicious have an "undo" slight ala gmail destroying annals instead displaying an irritating popup says, "are sure?".
the proceed i've implemented have "deleted_at" timestamp buttress denote gets timestamped destroy slight called
def destroy
@foo = foo.find(params[:id])
@foo.update_attribute(:deleted_at, time.now)
...
end
to revert/undo i'll only set same buttress nil
def revert
@foo = foo.find(params[:id])
@foo.update_attribute(:deleted_at, nil)
...
end
i'll only have supplement condition filter off "deleted" foos i method. maybe set cron credentials assign unequivocally destroy "deleted" foos after time.
works me easy exercise nonetheless i'm extraordinary there's improved proceed exercise feature? maybe there's plugin gem provides i don't know about?
Comments
Post a Comment