luckyframework / luckyframework/avram
Confusing error when calling the wrong preload method
Nobody has claimed this yet.
- Dominant language
- Crystal
- Stars
- 183
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
I'm getting this error, but haven't figured out why yet.
A `User` `has_one stream_approval : StreamApproval`
```
web |
web | 141 | UserSerializer.new(UserQuery.new.preload_stream_approval(current_user))
web | ^----------------------
web | Error: no overload matches 'UserQuery#preload_stream_approval' with type User
web |
web | Overloads are:
web | - User::BaseQuery#preload_stream_approval(preload_query : StreamApproval::BaseQuery)
web | - User::BaseQuery#preload_stream_approval()
web |
web | ---
```
The strange thing is that it only shows these two overloads, but there's 8 different versions of this method.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the UserQuery.new.preload_stream_approval(current_user) call shown in the report and inspect how the has_one association generates its preload_stream_approval overloads. Reproduce the compiler error and compare the generated overload list with the reported eight versions. Done means the incorrect or incomplete error output is explained and covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- crystal
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100