0

So, I have to fix this issue in a working project, and the idea is to have a way for a user to archive a record.

-if can?(:archive, @order_instruction) && !@order_instruction.archived?
  = link_to 'Cancelar', archive_order_instruction_path(@order_instruction), method: :patch, class: 'btn btn-danger', data: {confirm: 'A ordem vai ser arquivada e poderá ser visualizada na lista de arquivadas'}

I know I can alter the model and have a boolean field that I can change when someone looks at the record.

But I have been looking for a quicker fix. The objective is that if someone is performing the actions on said record, that is for instance, looking at it, the person who submitted should no longer be able to cancel/archive it, until those tasks are done by the first.

max
  • 96,212
  • 14
  • 104
  • 165

0 Answers0