2012-07-06 45 views
0

我想用我们的应用程序来生成屏幕截图。然而,代替我生成以下内容:升级到Rails 2.3.11,我得到一个未初始化的常量:: AWS错误

NameError在Step_results#表明

显示应用程序/视图/ step_results/show.html.haml其中行#26提出:

uninitialized constant StepResult::AWS 

提取的源(在#26附近):

23:  %p{ :title => @step_result.message }= h @step_result.message 
24:  = link_to 'close window', '#', :onclick => 'window.close();' 
25:  = link_to 'Screenshot', html_screen_shot_src(@step_result), :class => 'screenshot', :target => "frame", :id => "screenshot", :onclick => '$("a#screenshot").hide(); $("a#screenscrape").show()' unless html_screen_shot_src(@step_result).nil? 
26:  = link_to 'Screen Scrape', html_screen_scrape_src(@step_result), :class => 'screenscrape', :target => "frame", :id => "screenscrape", :onclick => '$("a#screenscrape").hide(); $("a#screenshot").show()' 
27:  
28:  #frame 
29:  %iframe{ :src => html_screen_scrape_src(@step_result), :name => 'frame' } 


/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:131:in `const_missing' 
/Users/jasonbodak/janova/janova/app/models/step_result.rb:73:in `html_scrape_url' 
/Users/jasonbodak/janova/janova/app/helpers/step_results_helper.rb:3:in `html_screen_scrape_src' 
/Users/jasonbodak/janova/janova/app/views/step_results/show.html.haml:26:in `_run_haml_app47views47step_results47show46html46haml' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_view/renderable.rb:34:in `send' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_view/renderable.rb:34:in `render' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_view/base.rb:306:in `with_template' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_view/renderable.rb:30:in `render' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_view/template.rb:205:in `render_template' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_view/base.rb:265:in `render_without_haml' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/haml-3.0.22/lib/haml/helpers/action_view_mods.rb:13:in `render' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/base.rb:1252:in `render_for_file' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/base.rb:978:in `render_without_benchmark' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/benchmarking.rb:51:in `render' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/activesupport-2.3.11/lib/active_support/core_ext/benchmark.rb:17:in `ms' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/activesupport-2.3.11/lib/active_support/core_ext/benchmark.rb:17:in `ms' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/benchmarking.rb:51:in `render' 
/Users/jasonbodak/janova/janova/app/controllers/step_results_controller.rb:4:in `show' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/base.rb:1333:in `send' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/base.rb:1333:in `perform_action_without_filters' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/filters.rb:617:in `call_filters' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/activesupport-2.3.11/lib/active_support/core_ext/benchmark.rb:17:in `ms' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/activesupport-2.3.11/lib/active_support/core_ext/benchmark.rb:17:in `ms' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/rescue.rb:160:in `perform_action_without_flash' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/flash.rb:151:in `perform_action' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/base.rb:532:in `send' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/base.rb:532:in `process_without_filters' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/filters.rb:606:in `process' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/base.rb:391:in `process' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/base.rb:386:in `call' 
/Users/jasonbodak/.rvm/gems/[email protected]_app/gems/actionpack-2.3.11/lib/action_controller/routing/route_set.rb:438:in `call' 

任何想法为什么我现在突然收到Amazon Worker Service错误?谢谢。

编辑:下面是html_scrape_url方法的代码:

def html_scrape_url 
    tries = 0 
    begin 
     return nil if html_filename.blank? 
     AWS::S3::S3Object.url_for(html_filename, s3_bucket) 
    rescue AWS::S3::NoConnectionEstablished => e 
     if tries < 1 
     logger.debug "S3 connection not established. Establishing..." 
     AWS::S3::Base.establish_connection!(
      :access_key_id => APP_CONFIG[:amazon_access_key_id], 
      :secret_access_key => APP_CONFIG[:amazon_secret_access_key] 
     ) 
     tries += 1 
     retry 
     end 
    end 
    end 
+0

您是否在使用此升级的导轨应用程序的打包程序?你从什么升级?你会添加方法'html_screen_scrape_src'的来源吗? – 2012-07-06 19:30:02

+0

嗨,杰西。我从Rails 2.3.5升级到Rails 2.3.11。我是新手,请耐心等待。无论如何,我确实使用捆绑软件。我第一次更新了我的Gemfile,以便它列出了2.3.11,然后我运行了bundle update rails。 下面是从html_screen_scrape_src我的代码: '模块StepResultsHelper' '高清html_screen_scrape_src(step_result)'' || step_result.html_scrape_url iframe_step_result_path(step_result)' 'end' – 2012-07-06 19:39:32

+0

app/models/step_result.rb中的html_scrape_url代码如何?(您可以编辑您的答案) – 2012-07-06 19:42:44

回答

0

OK,这是很奇怪的,但加入

require 'aws/s3' 

我的模型的顶部(称为step_result.rb,正如你在上面看到的)修复了这个问题。我必须承认,我不明白如何解决这个问题......我只是随机应变,但我很高兴我做到了。

相关问题