Skip to content

Replace deprecated require_dependency with require in preview loading#2589

Merged
joelhawksley merged 3 commits intomainfrom
copilot/remove-require-dependency
Mar 25, 2026
Merged

Replace deprecated require_dependency with require in preview loading#2589
joelhawksley merged 3 commits intomainfrom
copilot/remove-require-dependency

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 25, 2026

require_dependency was removed in Rails 7.1+ as part of the Zeitwerk-only autoloading transition. Its use in preview loading causes errors in modern Rails apps.

Changes

  • lib/view_component/preview.rb: Replace require_dependency with require in __vc_load_previews
# Before
Dir["#{preview_path}/**/*preview.rb"].sort.each { |file| require_dependency file }

# After
Dir["#{preview_path}/**/*preview.rb"].sort.each { |file| require file }
  • docs/CHANGELOG.md: Add entry under main

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@joelhawksley
Copy link
Copy Markdown
Member

@copilot please try again

Copilot AI changed the title [WIP] Remove deprecated require_dependency call in ViewComponent Replace deprecated require_dependency with require in preview loading Mar 25, 2026
@joelhawksley joelhawksley marked this pull request as ready for review March 25, 2026 15:08
@joelhawksley joelhawksley merged commit 192ccfb into main Mar 25, 2026
15 checks passed
@joelhawksley joelhawksley deleted the copilot/remove-require-dependency branch March 25, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

require_dependency in now deprecated and will be removed in Rails 9

2 participants