lib/attributor/dsl_compiler.rb in attributor-2.6.1 vs lib/attributor/dsl_compiler.rb in attributor-3.0

- old
+ new

@@ -98,10 +98,16 @@ end # determine attribute type to use if attr_type.nil? if block_given? - attr_type = Attributor::Struct + attr_type = if inherited_attribute && inherited_attribute.type < Attributor::Collection + # override the reference to be the member_attribute's type for collections + opts[:reference] = inherited_attribute.type.member_attribute.type + Attributor::Collection.of(Struct) + else + Attributor::Struct + end elsif inherited_attribute attr_type = inherited_attribute.type else raise AttributorException, "type for attribute with name: #{name} could not be determined" end