mardi 26 juin 2018

How do I update multiple columns in a table with one checkbox?

We're developing an in-house C.M.S. to keep track of our customers, relevant information, and to track issues that those customers have. To that end, we have a couple of columns in our "tickets" table - we have a "completed" boolean, a "completed_at" datetime, and a "completed_by" integer.

We're trying to come up with a couple of U.I. methods by which we could close a ticket - and in the "Edit Ticket" page, we want to have a single checkbox that we could check that would updated all three of those columns:

  1. "completed" from false to true
  2. "completed_at" from null to Time.now
  3. "completed_by" from null to current_user.id

We've tried a couple of different approaches from all over the web, but we're not entirely sure how we'd do this.




Aucun commentaire:

Enregistrer un commentaire