diff --git a/lib/avo/fields/field_manager.rb b/lib/avo/fields/field_manager.rb index 8b86f4d837..ed75c7c9d0 100644 --- a/lib/avo/fields/field_manager.rb +++ b/lib/avo/fields/field_manager.rb @@ -36,9 +36,11 @@ def all # Avo::Fields::DateTimeField -> date_time def init_fields Avo::Fields::BaseField.descendants.each do |class_name| - next unless valid_class_name?(class_name) + next if class_name.to_s == "BaseField" - load_field class_name.get_field_name, class_name + if class_name.to_s.end_with? "Field" + load_field class_name.get_field_name, class_name + end end end @@ -56,10 +58,6 @@ def load_field(name, klass) def field_exists?(name) fields.pluck(:name).map(&:to_sym).include?(name.to_sym) end - - def valid_class_name?(class_name) - class_name.to_s != "BaseField" && class_name.to_s.starts_with?("Avo::Fields") && class_name.to_s.end_with?("Field") - end end end end diff --git a/pluggy/lib/pluggy/fields/radio_field.rb b/pluggy/lib/pluggy/fields/radio_field.rb index dbabc9c28f..34e237ff0b 100644 --- a/pluggy/lib/pluggy/fields/radio_field.rb +++ b/pluggy/lib/pluggy/fields/radio_field.rb @@ -5,6 +5,8 @@ class RadioField < Avo::Fields::BaseField attr_reader :options + self.field_name_attribute = :pluggy_radio + def initialize(id, **args, &block) super(id, **args, &block)