lib/keepassx/entry.rb in ruby-keepassx-0.2.0 vs lib/keepassx/entry.rb in ruby-keepassx-0.2.1

- old
+ new

@@ -85,11 +85,11 @@ elsif payload.is_a? Hash fail "'title' is required" if payload[:title].nil? fail "'group' is required" if payload[:group].nil? self.group = payload[:group] - field_list = FIELD_MAPPING.keys - data = payload.select { |k| field_list.include? k } + fields = self.class.fields + data = payload.reject { |k, _| !fields.include? k } data[:group_id] = group.id @fields = [] default_fields.merge(data).each do |k, v| fail "Unknown field: '#{k}'" unless self.respond_to? "#{k}=", true