Skip to content

Instantly share code, notes, and snippets.

@rystraum
Created June 6, 2014 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rystraum/87872b1c1431af028518 to your computer and use it in GitHub Desktop.
Save rystraum/87872b1c1431af028518 to your computer and use it in GitHub Desktop.
# params
{"utf8"=>"✓",
"authenticity_token"=>"lHpn6sCR208J+vxmdoM1h5lbni8AMKZz2NrcOVcBGFo=",
"response"=>
{"answers_attributes"=>
{"0"=>{"question_id"=>"13", "value"=>"E"},
"1"=>{"question_id"=>"14", "value"=>"E"},
"2"=>{"question_id"=>"15", "value"=>"ewrq"},
"3"=>{"question_id"=>"16", "value"=>""},
"4"=>{"question_id"=>"17", "value"=>""},
"5"=>{"question_id"=>"18"},
"6"=>{"question_id"=>"19", "value"=>"1:30am"},
"7"=>{"question_id"=>"20", "value"=>"06/04/2014"},
"8"=>{"question_id"=>"21", "value"=>""},
"9"=>{"question_id"=>"22"},
"10"=>{"question_id"=>"23", "value"=>"No"},
"11"=>{"question_id"=>"24", "value"=>"06/05/1989"},
"12"=>{"question_id"=>"25", "value"=>["A", "B", "C", "D", "E"]},
"13"=>{"question_id"=>"26"}}},
"commit"=>"Submit form",
"action"=>"create",
"controller"=>"responses",
"form_id"=>"22"}
def response_params
parameters = params.require(:response).permit(:answers_attributes => [:question_id, :value])
parameters.merge(:ip_address => request.remote_ip)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment