granite
granite copied to clipboard
Issue with `group_by` ?
I'm using granite 0.19.0
and there seems to be an issue with group_by
or I'm making a mistake somewhere.
If I define a model, I can query it with #all
and #order
just fine, but #group_by
gives me:
Showing last frame. Use --error-trace for full trace.
In src/commands/build/content_loader.cr:28:24
28 | puts ContentItem.group_by(:published_at)
^-------
Error: undefined method 'group_by' for ContentItem.class
What am I doing wrong?
By the way, doing puts ContentItem.where.group_by(:published_at).select
works.
I think group_by
just needs added to https://github.com/amberframework/granite/blob/master/src/granite/query/builder_methods.cr#L15
Willing to improve https://github.com/amberframework/granite/pull/388 with some pointers!