I’m aware of ActiveRecord’s increment_counter…but I need to increment something by 0.5 instead of 1.
Something like: User.increment_counter(:credits_count, RECORD_ID, 0.5)
Is there some sort of helper/method for easily incrementing by 0.5? Or do I have to pull the record, get the current count and then add 0.5 to that count and save it?
You can use
.incrementSo basically would be
User.find(RECORD_ID).increment(:credits_count, 0.5)Api Doc Increment