From 8d4d27a3488d7165c5117ac03d44dd454e22f275 Mon Sep 17 00:00:00 2001 From: Paul Bob Date: Fri, 21 Feb 2025 18:59:03 +0200 Subject: [PATCH] fix: modify array resource constant registration to use Avo namespace --- lib/avo/resources/array_resource.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/avo/resources/array_resource.rb b/lib/avo/resources/array_resource.rb index 81aaf9637..2237cfec8 100644 --- a/lib/avo/resources/array_resource.rb +++ b/lib/avo/resources/array_resource.rb @@ -13,7 +13,7 @@ class ArrayResource < Base class << self def model_class - @@model_class ||= Object.const_set( + @@model_class ||= Avo.const_set( class_name, Class.new do include ActiveModel::Model @@ -68,7 +68,7 @@ def fetch_records(array_of_records = nil) # Dynamically create a class with accessors for all unique keys from the records keys = array_of_records.flat_map(&:keys).uniq - Object.const_set( + Avo.const_set( class_name, Class.new do include ActiveModel::Model @@ -82,7 +82,7 @@ def fetch_records(array_of_records = nil) end ) - custom_class = class_name.constantize + custom_class = "Avo::#{class_name}".constantize # Map the records to instances of the dynamically created class array_of_records.map do |item|