0

アプリを使用してスクリーンショットを生成しようとしています。ただし、代わりに次を生成します。

Step_results#showのNameError

行#26が発生したapp / views / step_results / show.html.hamlを表示しています:

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/ree-1.8.7-2011.03@janova-local_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/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_view/renderable.rb:34:in `send'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_view/renderable.rb:34:in `render'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_view/base.rb:306:in `with_template'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_view/renderable.rb:30:in `render'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_view/template.rb:205:in `render_template'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_view/base.rb:265:in `render_without_haml'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/haml-3.0.22/lib/haml/helpers/action_view_mods.rb:13:in `render'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/base.rb:1252:in `render_for_file'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/base.rb:978:in `render_without_benchmark'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/benchmarking.rb:51:in `render'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/activesupport-2.3.11/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/activesupport-2.3.11/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_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/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/base.rb:1333:in `send'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/base.rb:1333:in `perform_action_without_filters'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/filters.rb:617:in `call_filters'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/activesupport-2.3.11/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/activesupport-2.3.11/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/flash.rb:151:in `perform_action'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/base.rb:532:in `send'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/base.rb:532:in `process_without_filters'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/filters.rb:606:in `process'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/base.rb:391:in `process'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/base.rb:386:in `call'
/Users/jasonbodak/.rvm/gems/ree-1.8.7-2011.03@janova-local_app/gems/actionpack-2.3.11/lib/action_controller/routing/route_set.rb:438:in `call'

突然Amazonワーカーサービスエラーが発生する理由はありますか?ありがとう。

編集: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
4

1 に答える 1

0

OK、これは非常に奇妙ですが、追加します

require 'aws/s3'

私のモデルの一番上(上記のようにstep_result.rbと呼ばれます)で問題が修正されました。私はそれがどのようにそれを修正したのか理解していないことを認めなければなりません...私は気まぐれでそれを試しましたが、私はそれをしたことをうれしく思います。

于 2012-07-09T18:50:05.087 に答える