我在使用Rails参数进行过滤或未被解析时遇到了一些麻烦。当它在WEBRick上本地运行时工作正常但是一旦它在Heroku上运行它会忽略一堆提交的表单参数(它们不会被添加到params [])。
我提交表单并且它会因为它期望一个不存在的值而失败。 Airbrake告诉我 rack.request.form_hash 是这样的:
{“utf8”=>“✓”,“_ method”=>“put”,“authenticity_token”=>“8CZUmWc7qB1mWAbyn9NeGmygRVczdZCtI3CXwu0DUV4 =”,“survey_entry”=> {“pupil”=> ; {“id”=>“2784”,“non_vrh”=>“f”,“姓名缩写”=>“A”,“姓氏”=>“ABC”,“year_group_id”=>“5 “,”age_this_september_years“=>”“,”age_this_september_months“=>”“,”current_reading_level“=>”“},”问卷“=> {”answer“=> {”21“=> “6”,“22”=>“2”,“39”=>“”,“40”=>“”}}}}
但它也告诉我 action_dispatch.request.parameters 是这样的:
{“utf8”=>“✓”,“_ method”=>“put”,“authenticity_token”=>“8CZUmWc7qB1mWAbyn9NeGmygRVczdZCtI3CXwu0DUV4 =”,“survey_entry”=>“” ,“action”=>“update”,“controller”=>“survey_entries”,“id”=>“7”}
所以无疑我正在做的事情是愚蠢和愚蠢但是现在让我感到茫然:/
更新
奇怪的是,从同一页面提交的表单(但字段略有不同)可以正常工作:
UTF8:✓
_method:放
authenticity_token:HLCXURx1BosuXlVYwBuOP + DxJwdY3SKwilx1CJDuwT8 =
survey_entry [瞳孔] [ID]:2485
survey_entry [瞳孔] [non_vrh]:F
survey_entry [瞳孔] [缩写]:AAS
survey_entry [瞳孔] [姓]:ABC
survey_entry [瞳孔] [year_group_id]:4
survey_entry [瞳孔] [attendance_pct]:
survey_entry [瞳孔] [reading_level] [at_placement]:12
survey_entry [瞳孔] [reading_level] [at_term1]:
survey_entry [瞳孔] [reading_level] [at_term2]:
survey_entry [瞳孔] [reading_level] [at_term3]:
survey_entry [瞳孔] [previous_progress]:
survey_entry [瞳孔] [target_rl_id]:
survey_entry [瞳孔] [english_first_language]:0
survey_entry [瞳孔] [english_first_language]:1
survey_entry [瞳孔] [care_order]:0
survey_entry [瞳孔] [lac_funded]:0
survey_entry [瞳孔] [free_meals]:0
survey_entry [瞳孔] [selection_reason_id]:4
survey_entry [瞳孔] [other_selection_reason]:
survey_entry [问卷] [答案[3]]:2
survey_entry [问卷] [答案[4]]:2
survey_entry [问卷] [答案[13]]:3
survey_entry [问卷] [答案[14]]:3
survey_entry [问卷] [答案[20]]:3
答案 0 :(得分:1)
您是否有机会将survey_entry作为网址参数传递?
此SO entry指向查询参数与post参数的问题,这些参数可以解释您当前的行为。
答案 1 :(得分:0)
好的,足以说我真的很蠢。我会因为天气不好而责备它。感谢史蒂夫试图提供帮助,我现在将羞愧地抓狂:)