Get array hash values
===

So I am trying to grab all high schools and graduate schools from this array of hashes:

    "education": [
        {
          "school": {
            "id": "110703012290674", 
            "name": "Kunskapsgymnasiet Malmö"
          }, 
          "year": {
            "id": "136328419721520", 
            "name": "2009"
          }, 
          "type": "High School"
        }, 
        {
          "school": {
            "id": "112812485399398", 
            "name": "Malmö University"
          }, 
          "year": {
            "id": "118118634930920", 
            "name": "2012"
          }, 
          "concentration": [
            {
              "id": "104076956295773", 
              "name": "Computer Science"
            }
          ], 
          "type": "Graduate School", 
          "classes": [
            {
              "id": "165093923542525", 
              "name": "Programmering", 
              "description": "Kursen fokuserar på metoder och tekniker vid utveckling av webbapplikationer med hjälp av HTML5."
            }
          ]
        }
      ],

Like this:

    def add_friends
        facebook.get_connections("me", "friends",   :fields => "name, id, education").each do |hash|
          self.friends.where(:name => hash['name'], :uid => hash['id'], 
                                                    :highschool_name => hash['education']['school']['name'] if hash['type'] == "High School",
                                                    :graduateschool_name => hash['education']['school']['name'] if hash['type'] == "Graduate School").first_or_create
        end
      end

But it dosent work, I get a syntax error. Any ideas?