luckyframework / luckyframework/avram

Avram::Model#reload passes <Model>::BaseQuery to its block, should pass <Model>Query

Open
#387 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Crystal
Stars
183
Forks
67
PR merge metrics
No merged PRs in 30d

Description

For my `Language` model, `Avram::Model#reload` passes `Language::BaseQuery` to its block instead of `LanguageQuery`. Thus, when I try to use the `LanguageQuery#preload_parents` method which I added, I get this:
```
In src/operations/mixins/hierarchical_operation.cr:10:20
10 | o = o.reload(&.preload_parents.preload_url_path)
^--------------
Error: undefined method 'preload_parents' for Language::BaseQuery
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Avram::Model#reload and trace the query object passed to its block. Reproduce the failure from src/operations/mixins/hierarchical_operation.cr:10 using LanguageQuery#preload_parents, then verify that reload supplies LanguageQuery so the operation compiles and the preload chain works.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.