Hi,
New to ruby/rails. For my controller class as defined below, I get the
exception printed below the class definition. Have absolutely no idea
how to resolve it. Look forward to your help!
class HelloController < ApplicationController
def sayhello
require ‘rubygems’
require ‘scrubyt’
dell_data = Scrubyt::Extractor.define do
fetch
‘http://support.dell.com/support/topics/global.aspx/support/my_systems_info/details?c=us&l=en&s=gen’
fill_textfield ‘ServiceTag’, ‘3CTVR41’
submit
dell_data do
serviceTag “/tr[1]/td[2]”
systemType “/tr[2]/td[2]”
shipDate “/tr[3]/td[2]”
dellIBU “/tr[4]/td[2]”
end
end
render :text => dell_data.to_xml
end
end
NoMethodError in HelloController#sayhello
You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.parent
RAILS_ROOT: C:/Monica/flexiblerails/current/dbaccess
Application Trace | Framework Trace | Full Trace
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.2.6/lib/scrubyt/utils/xpathutils.rb:13:in
lowest_common_ancestor' c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.2.6/lib/scrubyt/core/scraping/filter.rb:123:in
generate_XPath_for_example’
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.2.6/lib/scrubyt/core/scraping/filter.rb:122:in
each' c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.2.6/lib/scrubyt/core/scraping/filter.rb:122:in
generate_XPath_for_example’
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.2.6/lib/scrubyt/core/scraping/filter.rb:113:in
loop' c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.2.6/lib/scrubyt/core/scraping/filter.rb:113:in
generate_XPath_for_example’
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.2.6/lib/scrubyt/core/shared/evaluation_context.rb:116:in
generate_examples' c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.2.6/lib/scrubyt/core/shared/evaluation_context.rb:116:in
each’
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.2.6/lib/scrubyt/core/shared/evaluation_context.rb:116:in
generate_examples' c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.2.6/lib/scrubyt/core/shared/evaluation_context.rb:115:in
generate_examples’
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.2.6/lib/scrubyt/core/shared/evaluation_context.rb:115:in
each' c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.2.6/lib/scrubyt/core/shared/evaluation_context.rb:115:in
generate_examples’
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.2.6/lib/scrubyt/core/shared/evaluation_context.rb:58:in
setup_examples' c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.2.6/lib/scrubyt/core/shared/extractor.rb:38:in
define’
app/controllers/hello_controller.rb:6:in `sayhello’