0.0
No commit activity in last 3 years
No release in over 3 years
This gem can define custom behavior when calling count on an AREL relation. This is especially useful when using relation.select('column AS something'), which currently will cause SQL errors.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Usage

To use this gem, simply include it in your Gemfile and invoke it as so:

results = MyModel.select("something AS something_else").counting { |arel| arel.except(:select) }
# Invokes the block so the select clause is removed, avoiding a bug in Rails.
size = results.count
# Includes the select as desired.
values = results.load