- Add compatibility for Rails 7.2
- Add compatibility for Rails 7.1
- Add support for associations defined on abstract models
- Add compatibility for Rails 6.1
- Fix handling for ActiveRecord's NullRelation (MyModel.none) in block and association's conditions.
- Added methods which return the SQL used by this gem:
assoc_exists_sql
,assoc_not_exists_sql
,compare_assoc_count_sql
,only_assoc_count_sql
Documentation for them
- Fix broken urls in error messages
- Now supports polymorphic belongs_to
- Use
SELECT 1
instead ofSELECT 0
...
... it just seems more natural that way. - Bugfixes
- It is now possible to pass a
Range
as first argument to#where_assoc_count
.
Ex: Users that have between 10 and 20 postsUser.where_assoc_count(10..20, :==, :posts)
The operator in that case must be either :== or :!=.
This will useBETWEEN
andNOT BETWEEN
.
Ranges that exclude the last value, i.e.5...10
, are also supported, resulting inBETWEEN 5 and 9
. Ranges with infinities are also supported.