Form_for params

I need to submit the form to an external URL, so I have the following:

form_for(@task, :url => "https://www.external.com/Submit") do |f|) <%= f.hidden_field :assignmentId, :value => @assignment %> <%= link_to image_tag(@imagelocation) %> .... 

I use form_for because I need to access my controller variables.

The external server is looking for the parameter, assignmentId . When the form is submitted, the parameter is actually available as

 params[:task][:assignmentId] 

which cannot be verified on an external server.

How do i solve this? How do I access variables from my controller and pass the bare parameters to an external server?

[edit] Here the send options look like

utf8 =% E2% 9C% 93 & _method = & put amp; task% 5BassignmentId% 5D = 2LVQ39Z0B6UWI8NXYWJTYRKGQXIMXN & task% 5Boutput% 5D = carpet & commit = Post

I want him to not have a given task.

+4
source share
1 answer

Use hidden_field_tag instead of f.hidden_field . Btw, if you want the destination identifier to be stored in this field, you should use @assignment.id , not just @assignment .

 <%= hidden_field_tag :assignmentId, @assignment.id %> 
+4
source

All Articles