Skip to content

Files

Latest commit

 

History

History
24 lines (16 loc) · 696 Bytes

Rails-ActiveSupportOnLoad.md

File metadata and controls

24 lines (16 loc) · 696 Bytes

Pattern: Use of Active Support load hook

Issue: -

Description

Checks for Rails framework classes that are patched directly instead of using Active Support load hooks. Direct patching forcibly loads the framework referenced, using hooks defers loading until it's actually needed.

Examples

# bad
ActiveRecord::Base.include(MyClass)

# good
ActiveSupport.on_load(:active_record) { include MyClass }

Further Reading