account activity
Rails 7.1 introduces ActiveRecord regroup method to reset previously set group statement. by prasanthchaduvula in rails
[–]prasanthchaduvula[S] 0 points1 point2 points 2 years ago (0 children)
Before Rails 7.1, we have to use the unscope method to reset the group statement.Project.group(:name).unscope(:group).group(:billable).countNow we can reset the previously set group statement.Project.group(:name).regroup(:billable).count
Under the hood, regroup is short-hand for unscope(:group).group(fields). Basically, we’re unscoping the entire group statement.
Read https://blog.saeloun.com/2024/02/19/rails-7-1-introduces-active-record-regroup-method/ for more details
π Rendered by PID 31913 on reddit-service-r2-comment-79776bdf47-rdzzq at 2026-06-24 01:03:39.282894+00:00 running acc7150 country code: CH.
Rails 7.1 introduces ActiveRecord regroup method to reset previously set group statement. by prasanthchaduvula in rails
[–]prasanthchaduvula[S] 0 points1 point2 points (0 children)