views:

34

answers:

1

Had some old code that on some condition would modify params. I believe it was working before (not 100%). We are now getting params set to nil whether or not the condition is met.

The culprit is within the condition, I perform a params = tmp.dup. Even when the condition is false, this is causing an error in the update action.

I was able to recreate with a minimal test

(Rails 2.3.5)

rails bug;
cd bug;

script/generate scaffold bug name:string;
rake db:create;
rake db:migrate;

edit apps/controllers/bugs_controller.rb add to beginning of update action

l_p = params.dup

if (false)

  params = l_p.dup  # NOT REACHED

end

script/server WEBrick -p 5001

browse to http://localhost:5001/bugs create a new bug edit bug submit