我在 rails 中没有使用 Activerecord 获得前几个月的 31 的费用
I dont get the expenses of the 31 of the previous months with Activerecord in rails
当我显示PUQ的总支出没有问题
Expend.where(cc: "PUQ").sum(:total)
但是当我想用这段代码按月单独显示时,我没有得到 31 的费用,只显示当月的 1 到 30。现在我没有收到 31-08-2020 的费用
Expend.where(cc: "PUQ").where(:created_at => ((Date.today.beginning_of_month)- 1.month)..((Date.today.end_of_month) - 1.month)).sum(:total)
提前致谢
当我显示PUQ的总支出没有问题
Expend.where(cc: "PUQ").sum(:total)
但是当我想用这段代码按月单独显示时,我没有得到 31 的费用,只显示当月的 1 到 30。现在我没有收到 31-08-2020 的费用
Expend.where(cc: "PUQ").where(:created_at => ((Date.today.beginning_of_month)- 1.month)..((Date.today.end_of_month) - 1.month)).sum(:total)
提前致谢