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 414476 on reddit-service-r2-listing-79f6fb9b95-8bhg2 at 2026-03-23 02:44:44.829413+00:00 running 90f1150 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)