lib/avo/fields/field_manager.rb in avo-3.6.0 vs lib/avo/fields/field_manager.rb in avo-3.6.1
- old
+ new
@@ -42,14 +42,22 @@
load_field class_name.get_field_name, class_name
end
end
end
- def load_field(method_name, klass)
+ def load_field(name, klass)
+ return if field_exists?(name)
+
fields.push(
- name: method_name.to_s,
+ name: name.to_s,
class: klass
)
+ end
+
+ private
+
+ def field_exists?(name)
+ fields.pluck(:name).map(&:to_sym).include?(name.to_sym)
end
end
end
end