luckyframework / luckyframework/avram
Including the DatabaseValidations in Avram::Operation causes compile error
Nobody has claimed this yet.
- Dominant language
- Crystal
- Stars
- 183
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
When you include the `Avram::DatabaseValidations` mixin in to any `Avram::Operation`, there's no `record` methods, so this line falls back to thinking `record` is Crystal's macro record.
https://github.com/luckyframework/avram/blob/9f727d22b3b8b913ef4c6d5e671abba241bdb308/src/avram/database_validations.cr#L107
Then you'll get a "wrong number of arguments for macro record" error. This is misleading though.
We can either rename `record` in the SaveOperation (which would be a breaking change)
https://github.com/luckyframework/avram/blob/9f727d22b3b8b913ef4c6d5e671abba241bdb308/src/avram/save_operation.cr#L38
Or we can include an empty record method in the operation
```crystal
private def record
# do nothing
end
```
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 src/avram/database_validations.cr at the referenced line and src/avram/save_operation.cr at the referenced method. Reproduce the compile error when including Avram::DatabaseValidations in an Avram::Operation, then determine which proposed resolution fits the API. Done means the mixin no longer produces the misleading macro record argument error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- crystal
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100