Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with group_by ? #387

Open
sardaukar opened this issue Apr 8, 2020 · 3 comments
Open

Issue with group_by ? #387

sardaukar opened this issue Apr 8, 2020 · 3 comments

Comments

@sardaukar
Copy link

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?

@sardaukar
Copy link
Author

By the way, doing puts ContentItem.where.group_by(:published_at).select works.

@Blacksmoke16
Copy link
Contributor

@sardaukar
Copy link
Author

Willing to improve #388 with some pointers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants