diff --git a/CHANGELOG.md b/CHANGELOG.md index 7771d2c..c6ade0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html ### Compatible changes +* Follow recommended way to extend Railties + ## 1.2.0 - 2023-03-15 diff --git a/lib/has_defaults/active_record_ext.rb b/lib/has_defaults/active_record_ext.rb index af2ff01..f70b242 100644 --- a/lib/has_defaults/active_record_ext.rb +++ b/lib/has_defaults/active_record_ext.rb @@ -76,6 +76,6 @@ def evaluate_raw_default_value(raw_value) end end -ActiveRecord::Base.extend(HasDefaults::ActiveRecordExt::ClassMethods) - - +ActiveSupport.on_load(:active_record) do + extend(HasDefaults::ActiveRecordExt::ClassMethods) +end