This is a before_action in a controller:
def map_params
Rails.logger.error "[before] #{params.inspect}"
if false
params = { :hi => :there }
end
Rails.logger.error "[after] #{params.inspect}"
end
This is an output:
[before] <ActionController::Parameters ...>
[after] nil
Interestrngly enough, if I comment out the params assignment it will behave differently:
[before] <ActionController::Parameters ...>
[after] <ActionController::Parameters ...>
Why is it happening?