How can I subtract 1 from a value in a Rails Controller it's easy in Postgresql
Update junkcars
Set junkcartotal = junkcartotal -1
Where id = 5161
In a rails controller I tried
Junkcars.update(junkcartotal: junkcartotal -1).where(id: 5161)
I get nothing but errors.
It's easy in rails too:
Junkcar.find(5161).decrement!(:junkcartotal)
https://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-decrement-21