luckyframework / luckyframework/avram

has_one should have automatic validator

Open
#373 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Given model A which has_one model B, not nilable; and model B which belongs_to model A, the foreign key is in Model B. Model A does not automatically validate that Model B exists before it is saved, but it should. For context, see https://gitter.im/luckyframework/Lobby?at=5ec87bab2280c80cbfc19651

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 by locating the association and validation entry points for has_one and belongs_to, then reproduce the Model A/Model B case described in the issue. Done means a non-nilable has_one relationship automatically validates that its belongs_to target exists before saving.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.