I’m trying to run a method in one of my controllers using a button_to command. How is this accomplished?
So far, I’ve got <%= button_to “Add to Cart”, action: “add_to_cart” %> in my products page
I defined a add_to_cart in my product controller, and created a route for it.
Am I on the right track? Will it execute code in that method in that controller?