Capybara:[]:Array的未定义方法`link'

时间:2022-08-22 22:43:23

I am trying to run simple test using cucumber/capybara. I want to visit a URL and it works when I do so manually. However, when I try to visit the URL using cucumber/capybara I am taken to an "Internal Server Error" page with the following error undefined method 'link' for []:Array

我正在尝试使用黄瓜/水豚进行简单的测试。我想访问一个URL,它可以在我手动操作时运行。但是,当我尝试使用cucumber / capybara访问URL时,我被带到“内部服务器错误”页面,其中包含以下错误:[]:Array的未定义方法'link'

Here is my code

这是我的代码

transfer.feature

transfer.feature

  Scenario: token transfer pixels from token shop
    Given I transfer tokens from token shop

transfer_steps.rb

transfer_steps.rb

Given /^I transfer tokens from token shop$/ do
  visit('/token-shop')
end

Here is the error logs

这是错误日志

/Users/simon/Documents/gamefuse/gf/app/views/token_shop/shared/_promos.html.haml:4:in `_app_views_token_shop_shared__promos_html_haml___2437011481481195334_70124182969840'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/template.rb:145:in `block in render'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/notifications.rb:125:in `instrument'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/template.rb:143:in `render'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/renderer/partial_renderer.rb:265:in `render_partial'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/renderer/partial_renderer.rb:238:in `block in render'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/renderer/partial_renderer.rb:237:in `render'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/newrelic_rpm-3.6.2.96/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:176:in `block in render_with_newrelic'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/newrelic_rpm-3.6.2.96/lib/new_relic/agent/method_tracer.rb:273:in `trace_execution_scoped'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/newrelic_rpm-3.6.2.96/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:175:in `render_with_newrelic'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/renderer/renderer.rb:41:in `render_partial'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/renderer/renderer.rb:15:in `render'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/helpers/rendering_helper.rb:24:in `render'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/haml-4.0.3/lib/haml/helpers/action_view_mods.rb:10:in `block in render_with_haml'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/haml-4.0.3/lib/haml/helpers.rb:89:in `non_haml'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/haml-4.0.3/lib/haml/helpers/action_view_mods.rb:10:in `render_with_haml'
      /Users/simon/Documents/gamefuse/gf/app/views/token_shop/index.html.haml:29:in `_app_views_token_shop_index_html_haml__779242564751016951_70124227746800'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/template.rb:145:in `block in render'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/notifications.rb:125:in `instrument'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/template.rb:143:in `render'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:46:in `block in render_template'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:45:in `render_template'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:18:in `render'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/newrelic_rpm-3.6.2.96/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:160:in `block in render_with_newrelic'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/newrelic_rpm-3.6.2.96/lib/new_relic/agent/method_tracer.rb:273:in `trace_execution_scoped'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/newrelic_rpm-3.6.2.96/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:159:in `render_with_newrelic'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/renderer/renderer.rb:36:in `render_template'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_view/renderer/renderer.rb:17:in `render'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:110:in `_render_template'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal/streaming.rb:225:in `_render_template'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:103:in `render_to_body'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal/renderers.rb:28:in `render_to_body'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:88:in `render'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal/rendering.rb:16:in `render'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
      /Users/simon/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/core_ext/benchmark.rb:5:in `ms'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:40:in `block in render'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activerecord-3.2.13/lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:39:in `render'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/remotipart-1.2.1/lib/remotipart/render_overrides.rb:14:in `render_with_remotipart'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:167:in `process_action'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal/rendering.rb:10:in `process_action'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:458:in `_run__4434222007848262428__process_action__3763121460391815624__callbacks'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:17:in `process_action'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal/rescue.rb:29:in `process_action'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activerecord-3.2.13/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/newrelic_rpm-3.6.2.96/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:38:in `block in process_action'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/newrelic_rpm-3.6.2.96/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:318:in `perform_action_with_newrelic_trace'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/newrelic_rpm-3.6.2.96/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:37:in `process_action'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:121:in `process'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:45:in `process'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal.rb:203:in `dispatch'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_controller/metal.rb:246:in `block in action'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:36:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:612:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/rack-pjax-0.7.0/lib/rack/pjax.rb:12:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/route_downcaser-0.2.0/lib/route_downcaser/downcase_route_middleware.rb:21:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/newrelic_rpm-3.6.2.96/lib/new_relic/rack/error_collector.rb:12:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/newrelic_rpm-3.6.2.96/lib/new_relic/rack/agent_hooks.rb:18:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/newrelic_rpm-3.6.2.96/lib/new_relic/rack/browser_monitoring.rb:16:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/warden-1.2.1/lib/warden/manager.rb:35:in `block in call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/warden-1.2.1/lib/warden/manager.rb:34:in `catch'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/warden-1.2.1/lib/warden/manager.rb:34:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/remotipart-1.2.1/lib/remotipart/middleware.rb:27:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activerecord-3.2.13/lib/active_record/query_cache.rb:64:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `_run__1537760651371211515__call__2831774802156914086__callbacks'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/cucumber-rails-1.3.1/lib/cucumber/rails/action_controller.rb:10:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/railties-3.2.13/lib/rails/rack/logger.rb:32:in `call_app'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `block in call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:in `tagged'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/railties-3.2.13/lib/rails/application.rb:223:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/rack-1.4.5/lib/rack/builder.rb:134:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/rack-1.4.5/lib/rack/urlmap.rb:64:in `block in call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `each'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/capybara-2.1.0/lib/capybara/server.rb:19:in `call'
      /Users/simon/.rvm/gems/ruby-1.9.3-p392@changyou-us.gf.master/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
      /Users/simon/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
      /Users/simon/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
      /Users/simon/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

EDIT And here is the haml file mentioned in the error log _promos.html.haml

编辑这是错误日志_promos.html.haml中提到的haml文件

.promos
  .item
    -if @token_shop_promotion
      -if @token_shop_promotion.link == "empty"
        = image_tag @token_shop_promotion.image.url, :alt => @token_shop_promotion.title, :height => 456, :width => 444
      -else
        = link_to(image_tag(@token_shop_promotion.image.url, :alt => @token_shop_promotion.title, :height => 456, :width => 444), @token_shop_promotion.link, :target => 'blanck')

1 个解决方案

#1


3  

It seems that @token_shop_promotion is an array in your partial, when you expect it to be a singular object. Make sure the data is what you expect it to be, the is pretty much the first step/rule in any debugging scenario.

似乎@token_shop_promotion是你的部分数组,当你期望它是一个单一的对象时。确保数据符合您的预期,这几乎是任何调试方案中的第一步/规则。

In your case it seems that you assume the data you are using to be different, it fails because of that and instead of verifying your assumptions, you go on a wild goose hunt :)

在你的情况下,似乎你假设你使用的数据是不同的,它失败,因为这而不是验证你的假设,你继续疯狂的鹅狩猎:)

Reminds me of this blog post, read it :)

让我想起这篇博客文章,阅读它:)

#1


3  

It seems that @token_shop_promotion is an array in your partial, when you expect it to be a singular object. Make sure the data is what you expect it to be, the is pretty much the first step/rule in any debugging scenario.

似乎@token_shop_promotion是你的部分数组,当你期望它是一个单一的对象时。确保数据符合您的预期,这几乎是任何调试方案中的第一步/规则。

In your case it seems that you assume the data you are using to be different, it fails because of that and instead of verifying your assumptions, you go on a wild goose hunt :)

在你的情况下,似乎你假设你使用的数据是不同的,它失败,因为这而不是验证你的假设,你继续疯狂的鹅狩猎:)

Reminds me of this blog post, read it :)

让我想起这篇博客文章,阅读它:)