Skip to content

Backport Fix circular require warning in belongs_to.rb #8601

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

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

tagliala
Copy link
Contributor

@tagliala tagliala commented Jan 8, 2025

When running specs with RUBYOPTS='-w', numerous warnings are generated due to a circular require between:

  • lib/active_admin/resource/belongs_to.rb
  • lib/active_admin/resource.rb

The warning message is:

warning: loading in progress, circular require considered harmful - ./lib/active_admin/resource.rb

Based on the code history, there is no specific reason for the inverse require from belongs_to to resource.

This change removes the unnecessary require to eliminate the warnings.

Copy link

codecov bot commented Jan 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (3-0-stable@c0749f5). Learn more about missing BASE report.

Additional details and impacted files
@@              Coverage Diff              @@
##             3-0-stable    #8601   +/-   ##
=============================================
  Coverage              ?   99.19%           
=============================================
  Files                 ?      194           
  Lines                 ?     4962           
  Branches              ?        0           
=============================================
  Hits                  ?     4922           
  Misses                ?       40           
  Partials              ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tagliala tagliala changed the title Fix circular require warning in belongs_to.rb 3.x Fix circular require warning in belongs_to.rb Jan 8, 2025
@javierjulio javierjulio changed the title 3.x Fix circular require warning in belongs_to.rb Backport Fix circular require warning in belongs_to.rb Jan 8, 2025
@javierjulio javierjulio self-requested a review January 8, 2025 16:11
Copy link
Member

@javierjulio javierjulio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

When running specs with `RUBYOPTS='-w'`, numerous warnings are generated
due to a circular require between:
- `lib/active_admin/resource/belongs_to.rb`
- `lib/active_admin/resource.rb`

The warning message is:

```
warning: loading in progress, circular require considered harmful - ./lib/active_admin/resource.rb

```

Based on the code history, there is no specific reason for the inverse
require from `belongs_to` to `resource`.

This change removes the unnecessary require to eliminate the warnings.

Backports #8598 to `3-0-stable` branch
@tagliala tagliala merged commit 8045939 into 3-0-stable Jan 8, 2025
21 checks passed
@tagliala tagliala deleted the backport-8599 branch January 8, 2025 22:12
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.

2 participants