Skip to content

Files

Latest commit

 

History

History
25 lines (16 loc) · 715 Bytes

Rails-RequireDependency.md

File metadata and controls

25 lines (16 loc) · 715 Bytes

Pattern: Use of require_dependency

Issue: -

Description

Checks for the usage of require_dependency.

require_dependency is an obsolete method for Rails applications running in Zeitwerk mode. In Zeitwerk mode, the semantics should match Ruby's and no need to be defensive with load order, just refer to classes and modules normally. If the constant name is dynamic, camelize if needed, and constantize.

Applications running in Zeitwerk mode should not use require_dependency.

Examples

# bad
require_dependency 'some_lib'

Further Reading