Skip to content

Commit 361e98b

Browse files
authored
fix: modify array resource constant registration to use Avo namespace (#3685)
1 parent 9f81a6c commit 361e98b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/avo/resources/array_resource.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ArrayResource < Base
1313

1414
class << self
1515
def model_class
16-
@@model_class ||= Object.const_set(
16+
@@model_class ||= Avo.const_set(
1717
class_name,
1818
Class.new do
1919
include ActiveModel::Model
@@ -68,7 +68,7 @@ def fetch_records(array_of_records = nil)
6868
# Dynamically create a class with accessors for all unique keys from the records
6969
keys = array_of_records.flat_map(&:keys).uniq
7070

71-
Object.const_set(
71+
Avo.const_set(
7272
class_name,
7373
Class.new do
7474
include ActiveModel::Model
@@ -82,7 +82,7 @@ def fetch_records(array_of_records = nil)
8282
end
8383
)
8484

85-
custom_class = class_name.constantize
85+
custom_class = "Avo::#{class_name}".constantize
8686

8787
# Map the records to instances of the dynamically created class
8888
array_of_records.map do |item|

0 commit comments

Comments
 (0)