How to fix this? undefined method `links' for #<Mechanize::Image:0x120a7e38> (NoMethodError) : My spider script is stuck at this error:   
   
    mySpiderScript.rb:119:in ` block (3 levels) in <main>': undefined method `links' for #<Mechanize::Image:0x120a7e38> (NoMethodError)   
     
Some code:   
   
    page2 = agent2.get('http://www.mywebsite.net')
  	  page2.links.each do |link2|     #line 119
  		name = link2.href.to_s   
   
How do I fix this so that the script keeps running?   

  
 