Params being overwritten - how is this possible?

Hi all,

I’m trying to come up with a simple way to handle the user hitting a
back button in a particular scenario, and I think flashing the params[]
array would be a simple solution. However, I have a piece of code that
is doing something very unexpected in the controller. The start of the
controller looks like this:

def index
logger.debug(“VALUE OF PARAMS IS: #{params}”)

#handle the case when the user hit the back button
if !flash[:params].nil?
  logger.debug("OVERWRITING PARAMS")
  params = flash[:params]
else
  logger.debug("USING REGULAR PARAMS: #{params}")
end

And I get this in the logs:

VALUE OF PARAMS IS: isbnurihttp://www.amazon.co.u (… rest of params)
USING REGULAR PARAMS:

So, it’s as if the parameter array is being wiped clean, even though the
“if” block of the code isn’t being exectued, only the else block.

How is this possible?

Thanks!
Tom