I have a form with hidden field:
<%= f.hidden_field(:equipment_id, :value => " ") %>
The value for this field is submitted via js. So that my generated html looks like this:
<input value="2" type="hidden" name="programm[equipment_id]" id="programm_equipment_id">
When i submit my form my parameters look like this:
"programm"=>{
.. some other params ..,
"equipment_id"=>"2"
}
In my controller's create method I try to assign equipment_id parameter to @programm.equipment_id:
@programm.equipment_id = params[:programm => :equipment_id ]
like that. Where equipment_id is an integer column in database. The problem is that nothing gets assigned. If i try to cast .to_i "0" is being assigned and stored in database. I also tried to do:
@programm.equipment_id = params[:equipment_id ]
But the problem is the same.