2013-12-23 57 views
1

所以我目前正在嘗試使用我的導軌應用程序和寶石'rturk'發佈HIT到mturk。除了當我打開HIT的亞馬遜網址時,整個過程能夠順利進行,我的Rails應用程序的表單不會顯示在iframe中。這只是一個空白的iframe。當我查看該頁面的源代碼時,可以清楚地看到正確的鏈接,其中包含了assignId,hitId和workerId。所以沒有理由不應該顯示,對吧?這裏是表單的一部分,以顯示mturk:ExternalQuestion表單不顯示在亞馬遜機械土耳其

<%= form_for @results, :url => 'https://workersandbox.mturk.com/mturk/externalSubmit', html: {class: "takeTest takeScale"} do |f| %> 

<%= hidden_field_tag 'assignmentId', @assignment_id %> 
<%= hidden_field_tag 'hitId', @hit_id %> 
<%= hidden_field_tag 'workerId', @worker_id %> 

<%= f.submit("Submit Answers", class: 'btn btn-info') %> 

這裏是使用rturk創建形式爲HIT我的控制器的一部分:

#post to amazon mturk 
    RTurk.setup('MYKEY', 'MYOTHERKEY', :sandbox => true) 
    @hit = RTurk::Hit.create(:title => "#{@scale.title}") do |hit| 
     hit.max_assignments = 5 
     hit.description = 'post' 
     hit.question("https://my-rails-app.herokuapp.com/tests/scale/take/#{@scale.id}", 
        :frame_height => 500) # pixels for iframe 
     hit.reward = 0.05 
     hit.qualifications.add :approval_rate, { :gt => 80 } 
    end 
    redirect_to root_url, :notice => "posted at: #{@hit.url} !!!" 

我想知道是否有事可做與我的形式,或者如果這是與託管在heroku上做什麼?任何幫助將非常感激。這裏是亞馬遜iframe的來源,以表明它應該都是工作:

<iframe height="500" scrolling="auto" frameborder="0" align="center" src="https://my-rails-app.herokuapp.com/tests/scale/take/7?assignmentId=2IBHSTLB3L0FPI5VSJAEMREVGFBIU0&amp;hitId=2FC98JHSTLB3ZZBONH9OEJEJ4E6FRO&amp;workerId=A1GHEKG3TRCQ5Y&amp;turkSubmitTo=https%3A%2F%2Fworkersandbox.mturk.com" name="ExternalQuestionIFrame"></iframe> 

謝謝!

+0

難道僅僅是因爲我還沒有明確的設置我的SSL?我參考https並且該鏈接可以直接使用,所以我認爲我不需要設置它。 Chrome並沒有給我一個混合內容的警告,但我認爲這可能是因爲無論如何..我的東西? – AlexTheGoodman

+0

我不認爲我有任何東西。 「SSL端點只對自定義域有用,所有默認的appname.herokuapp.com域都已啓用SSL,並且只需使用https即可訪問,例如https://appname.herokuapp.com。」 – AlexTheGoodman

+0

我懂了!如果您像我一樣遇到十億令人頭痛的問題,請在遭受任何進一步的攻擊之前檢查此信息:application.rb在您的config目錄中。如果在你的mturk HIT頁面上,javascript控制檯會給出一個x幀錯誤,請將其添加到你的應用程序中。012b config.action_dispatch.default_headers.clear Bam!我確信在整個故障排除過程中,我創建並解決了其他問題,但我希望這篇文章能夠幫助您解決問題!快樂的turking。 – AlexTheGoodman

回答

0

我能確認turkee寶石同樣的問題on Rails的4.2

的解決方案是爲@AlexTheGoodman在上面的評論中指出。

修改你的〜/配置/ application.rb中,並添加以下內容:

class Application < Rails::Application 
    config.action_dispatch.default_headers.clear 
end