fengb / fengb/arlj

Use pure ActiveRecord syntax

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Instead of this silly DSL:

``` ruby
Parent.left_joins_aggregate(:children, 'COUNT(*)' => 'children_count', where: {age: 1..5})
```

we should be able to use AR directly:

``` ruby
children_subquery = Child.where(age: 1..5).select('COUNT(*) AS children_count')
Parent.left_joins_aggregate(children_subquery)
Parent.left_joins_aggregate(children: children_subquery) #alternative in case we have more than one relation to the same table
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.