Question. How do i stop a form posting the same data again?

I have a create form, that assigns a shift to a user for a specific day. but i dont want to be able to assign another shift to that same user on the same day. how on earth do i go about doing this in ruby? I will have to do the same to the form to edit the shift too?

1 thought on “Question. How do i stop a form posting the same data again?”

  1. Can you post your code so far, so that we can see what you’ve tried?

    Off the top of my head, I’m assuming that you have models for user and shift. Let’s think of it this way – for a given day, a user either has a shift, or does not, right? So, if I come up to you, and say, “u/kongosaurus_rex, have you been assigned a shift for tomorrow?” you would answer either yes, or no, right? Does that give you an idea for the type of method you would create to determine if a shift has been assigned to a user for a particular day?

    Reply

Leave a Comment