diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d440cea..d55ea51e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## next - unreleased - Fix relation matching when attribute name collides with a method. [#281](https://github.com/active-hash/active_hash/pull/281) @flavorjones +- Fix association reflection in applications that don't use ActiveHash::Associations. [#286](https://github.com/active-hash/active_hash/pull/286) @iberianpig ## Version [3.2.0] - 2023-05-06 diff --git a/lib/associations/associations.rb b/lib/associations/associations.rb index e41a7cd0..99e2f046 100644 --- a/lib/associations/associations.rb +++ b/lib/associations/associations.rb @@ -3,6 +3,10 @@ module Associations module ActiveRecordExtensions + def self.extended(base) + require_relative 'reflection_extensions' + end + def belongs_to(name, scope = nil, **options) klass_name = options.key?(:class_name) ? options[:class_name] : name.to_s.camelize klass = @@ -92,7 +96,6 @@ def belongs_to_active_hash(association_id, options = {}) end def self.included(base) - require_relative "reflection_extensions" base.extend Methods end