Rails: How to toggle a boolean field from a view?
- by sscirrus
Very simple question.
I have a boolean field called "saved" in my database. I want to toggle this field by clicking on a text link that changes from "Save" to "Unsave" depending on the situation, and updates my "Customer" table with 0 or 1. I imagine Javascript may be a way to go for this but I am not experienced enough (yet!) in Javascript to know how to code it.
What is the best way to approach this problem, and how can I find the code I would need to drop into my view to make this toggle work? Thank you very much.