diff --git a/lib/avo/plugin_manager.rb b/lib/avo/plugin_manager.rb index e051e31af6..c35a43527b 100644 --- a/lib/avo/plugin_manager.rb +++ b/lib/avo/plugin_manager.rb @@ -13,6 +13,12 @@ def register(name, priority: 10) end def register_field(method_name, klass) + # Avo.boot method is executed multiple times. + # During the first run, it correctly loads descendants of Avo::Fields::Base. + # Plugins are then loaded, introducing additional descendants to Avo::Fields::Base. + # On subsequent runs, Avo::Fields::Base descendants now include these plugin fields. + # This field_name_attribute assign forces the field name to retain the registered name instead of being computed dynamically from the field class. + klass.field_name_attribute = method_name Avo.field_manager.load_field method_name, klass end diff --git a/pluggy/lib/pluggy/fields/radio_field.rb b/pluggy/lib/pluggy/fields/radio_field.rb index 34e237ff0b..dbabc9c28f 100644 --- a/pluggy/lib/pluggy/fields/radio_field.rb +++ b/pluggy/lib/pluggy/fields/radio_field.rb @@ -5,8 +5,6 @@ class RadioField < Avo::Fields::BaseField attr_reader :options - self.field_name_attribute = :pluggy_radio - def initialize(id, **args, &block) super(id, **args, &block)