def parse_fields
      fields.each_with_object({}) do |f, h|
        h[f[:name].split('/').first] ||= {}
        h[f[:name].split('/').first][f[:name].split('/').last] = f[:value]
      end
    end
def parse_fields
      fields.each_with_object({}) do |f, h|
        h[f[:name].split('/').first] ||= {}
        h[f[:name].split('/').first][f[:name].split('/').last] = f[:value]
      end
    end
fields =>
 [
   { name: 'users/first_name', value: 'Asterix' },
   { name: 'users/last_name', value: 'LeGaulois' },
   { name: 'companies/name', value: 'PotionCorp' }
 ]
 parse_field transforms it to

  {
    users: {
      first_name: 'Asterix',
      last_name: 'LeGaulois'
    },
    companies: { name: 'PotionCorp' }
  }