diff --git a/lib/avo/concerns/has_fields.rb b/lib/avo/concerns/has_fields.rb index 9ebe43b014..e5df612f94 100644 --- a/lib/avo/concerns/has_fields.rb +++ b/lib/avo/concerns/has_fields.rb @@ -294,8 +294,10 @@ def get_items panelfull_items.grep(Avo::TabGroup).each do |tab_group| tab_group.items.grep(Avo::Tab).each do |tab| tab.items.grep(Avo::Panel).each do |panel| - panel.items.grep(Avo::Fields::BelongsToField).each do |field| - field.target = :_top + set_target_to_top panel.items.grep(Avo::Fields::BelongsToField) + + panel.items.grep(Avo::Row).each do |row| + set_target_to_top row.items.grep(Avo::Fields::BelongsToField) end end end @@ -315,6 +317,12 @@ def get_items private + def set_target_to_top(fields) + fields.each do |field| + field.target = :_top + end + end + def check_license if !Rails.env.production? && App.license.present? && App.license.lacks(:resource_tools) # Add error message to let the developer know the resource tool will not be available in a production environment.