1

I have a Rails 5 app with 2 models : User & Application User can apply to another User through Application model

When an Application is created by User 1 to User 2, both users can see it inside their Application#index view.

Each User can delete an application, but that must not impact the visibility for the second user involved.

Example :

  • User 1 apply to User 2
  • User 1 and User 2 have the application inside Application#index view
  • User 1 soft delete application
  • User 1 do not see the application in Application#index
  • User 2 still see the application in Application#index

What is the most correct way to deal with this situation ?

  • Create 2 column sender_deleted & receiver_deleted and fill them accordinately with date + scope {sender_deleted: nil } for index
  • Create an entry for each user in Application then retrieve only the ones for each user ?
  • Other way ?

The second way seems proper, but the only info that differs in the table is the deletion date so it seems a little redundant.

Please note that I use the Paranoia gem for regular soft delete in my other models, not possible here with the 1 solution but possible with the second as only one column will be necessary to define the user as deleted.

Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367
Mene
  • 344
  • 2
  • 14

0 Answers0