Problem with Hpricot and attributes

I am trying to run the following code:

require 'rubygems'
require 'hpricot'
require 'open-uri'

doc = Hpricot(open("****the url is here***"))
tables =(doc/"table")
(tables[6]/"tr").each do |major|
  name ="td").first.inner_html
  link ="a")
  path = link.attributes['href']
  puts path

Everytime I run it, I get this error though: undefined method
`attributes' for #<Hpricot::Elements[]> (NoMet

Am I missing something?

#search always returns an array of elements, even if it only found one.

Use #at if you only want the first element.