I have a method in a helper file that I want activated only when a button is pressed.
def add_f01
@count = Count.find_by_user_id(@user)
@car = Car.find_by_user_id(@user)
@car.toggle!(:f01)
@count.increment!(:v01)
end
How do I do it, please?
I’ve created a working app here: https://github.com/noahc/stackoverflow
Pull it down and play around with it so you can learn how it works.
Essentially you need the following: