0 like 0 dislike
1 view
in ROR by anonymous Bilge (165k points)
rails parameters params expect extract remove key delete parameter

1 Answer

0 like 0 dislike
by anonymous Bilge (165k points)
puts "-------------------    Start    ---------------------------"
puts "Params: " + params.inspect
puts "Get parameter from params: " + params[:name_c].to_s
puts "Expect[  : " + params.except[:name_c].to_s
puts "Expect(  : " + params.except(:name_c).to_s
puts "Extract[ : " + params.extract![:name_c].to_s
puts "Extract( : " + params.extract!(:name_c).to_s
puts "Updated Params: " + params.inspect
puts "-------------------    Finish    ---------------------------"
Params: #<ActionController::Parameters 
{"name_m"=>"as", "adres"=>"as", "phone"=>"as", 
"mn"=>"2", "name_c"=>"2"} permitted: true>
Get parameter from params: 2
Expect[  : 2
Expect(  : {"name_m"=>"as", "adres"=>"as", "phone"=>"as", "mn"=>"2"}
Extract[ : 
Extract( : {"name_c"=>"2"}
Updated Params: #<ActionController::Parameters 
{"name_m"=>"as", "adres"=>"as", "phone"=>"as", 
"mn"=>"2", "name_c"=>"2"} permitted: true>
...