Skip to content

Commit

Permalink
Merge pull request #286 from iberianpig/fix/hook-for-reflection-exten…
Browse files Browse the repository at this point in the history
…sions

require reflection_extensions when ActiveRecordExtensions is extended
  • Loading branch information
flavorjones authored Aug 11, 2023
2 parents 4d08471 + 9a83682 commit 133b47d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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] - <sub><sup>2023-05-06</sup></sub>
Expand Down
5 changes: 4 additions & 1 deletion lib/associations/associations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 133b47d

Please sign in to comment.