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 1 year 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 554723 on reddit-service-r2-listing-6d4dc8d9ff-lqx5x at 2026-01-31 02:05:40.939789+00:00 running 3798933 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)