In my controller, I want to get some parameters, such as params [: test] [: test_page]

In my controller, I want to get some parameters, for example

params[:test][:test_page]

This code is on the edit page, for example

<%= test.title%>

I cannot give this in a collection or in any other field, because I do not allow the user to edit this, showing something like fixed

since I can pass this to the controller. I have a general idea of ​​one code, so we give it as a link

<%= collection_select(:test,:test_page, @testplantemplates, :id, :title,:selected => @test_plan_template_id) %>

How can we do this? I tried to hide_field, but it only allows 2 arguments. Can you give me an example or idea?

part of my code

<% if @secu.test_plan  %>
  <%= @secu.test_plan.title %>
<% else %>
    <%= collection_select(:test_plan,:test_plan_template_id, @testplantemplates, :id, :title, :prompt => true, :selected => @test_plan_template_id) %>
<% end %>
+3
source share
2 answers

Try adding the html name parameter, for example:

<%= collection_select(:test_plan,:test_plan_template_id, @testplantemplates, 
:id, :title, :prompt => true, :selected => @test_plan_template_id), 
:name => "test[test_page]" %>
0

. :

<%= hidden_field_tag "test[test_page]", @test_plan_template_id %>
+3

All Articles