0

在试图让土耳其人工作时,我得到了一个undefined methodreverse_merge!对于 nil:NilClass` 错误。

我的代码:

class MechanicalTurksController < ApplicationController
  def new
    @mechanical_turk = MechanicalTurk.new
    @disabled = Turkee::TurkeeFormHelper::disable_form_fields?(params)
  end
end

<%= turkee_form_for(@mechanical_turk, params) do |f| %>
    <%= f.label :first_name %>
    <%= f.text_field :first_name, disabled: @disabled %>

    <br />
    <%= f.submit "Save", class:"btn btn-primary", disabled: @disabled %>
<% end %>

class MechanicalTurk < ActiveRecord::Base

end

我认为问题在于params哈希。我认为它缺少一些东西。文件说

Mechanical Turk 现在要求将 hitId、workerId 和 turkSubmitTo 参数与 assignmentId 和表单参数一起传递。

这是我的日志的输出:

Started GET "/mechanical_turks/new?assignmentId=ASSIGNMENT_ID_NOT_AVAILABLE&hitId=2Z2MN9U8P9Y3B78UW1US1YIM5R7VEG" for 208.54.40.228 at 2012-05-08 17:35:24 -0400
Processing by MechanicalTurksController#new as HTML
  Parameters: {"assignmentId"=>"ASSIGNMENT_ID_NOT_AVAILABLE", "hitId"=>"2Z2MN9U8P9Y3B78UW1US1YIM5R7VEG"}
  Rendered mechanical_turks/new.html.erb within layouts/application (0.9ms)
Completed 500 Internal Server Error in 2ms

ActionView::Template::Error (undefined method `reverse_merge!' for nil:NilClass):
    1: <%= turkee_form_for(@mechanical_turk, params) do |f| %>
    2:     <%= f.label :first_name %>
    3:     <%= f.text_field :first_name, disabled: @disabled %>
    4: 
  app/views/mechanical_turks/new.html.erb:1:in `_app_views_mechanical_turks_new_html_erb___897197135_79286580'

我还在GitHub 上发布了一个问题。

4

1 回答 1

0

使用来自 github 的最新版本,现在可以使用。

于 2012-05-09T19:05:31.327 回答