Just try the method instead of scope. It works like a charm, and I ran into the same problem, but when I changed my scope to a method, it works great. Below is a working and verified code :)
def self.total_quantity sum('quantity') end
Let me know if this works or not! thanks
Vivek parihar
source share