lib/avo/fields/field_manager.rb in avo-3.0.0.pre13 vs lib/avo/fields/field_manager.rb in avo-3.0.0.pre14

- old
+ new

@@ -9,16 +9,26 @@ end end attr_reader :fields - alias_method :all, :fields - def initialize @fields = [] end + def all + fields + .map do |field| + field[:name] = field[:name].to_s + + field + end + .uniq do |field| + field[:name] + end + end + # This method will find all fields available in the Avo::Fields namespace and add them to the fields class_variable array # so later we can instantiate them on our resources. # # If the field has their `def_method` set up it will follow that convention, if not it will snake_case the name: # @@ -34,10 +44,10 @@ end end def load_field(method_name, klass) fields.push( - name: method_name, + name: method_name.to_s, class: klass ) end end end