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

dx: raise informative error when inverse_of is missing on STI #3414

Merged
merged 2 commits into from
Nov 18, 2024

Conversation

Paul-Bob
Copy link
Contributor

Description

Fixes #3406

In STI models, the inverse_of option is essential on associations for correctly configuring via_* parameters on links.

When Avo encounters an STI model without inverse_of set in the reflection, it will raise an informative error in development environment only.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

Screenshots & recording

class Users::Student < User
  has_many :marks, foreign_key: :student_id
end

image

Copy link

codeclimate bot commented Nov 13, 2024

Code Climate has analyzed commit 2b44d0b and detected 0 issues on this pull request.

View more on Code Climate.

@Paul-Bob Paul-Bob self-assigned this Nov 13, 2024
@Paul-Bob Paul-Bob merged commit f27665a into main Nov 18, 2024
22 checks passed
@Paul-Bob Paul-Bob deleted the dx/raise_inverse_of_informative_errro_on_sti branch November 18, 2024 08:29
Copy link
Contributor

This PR has been merged into main. The functionality will be available in the next release.

Please check the release guide for more information.

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

Successfully merging this pull request may close these issues.

Issues with has_many relation for STI model
1 participant