parameters - How to modify params hash before redirect in Rails 5? -


i have controller action i'd redirect different action on different controller.

the original action takes :id parameter, redirect target not take :id parameter. therefore, actioncontroller error:

no route matches {:action=>"next", :controller=>"imagelabelscontroller", :id=>"20"} 

my first thought delete :id params hash:

params.delete :id redirect_to controller: "imagelabelscontroller", action: "next" 

for reason, call params.delete having no effect. can put breakpoint right after params.delete , :id key appear have been deleted:

(byebug) params <actioncontroller::parameters {"controller"=>"jobs", "action"=>"show"}  permitted: false> 

yet reason controller still looking route :id in it.

what's rails 5 approach situation?

note, question rails 5. several historic answers discuss situation rails 3 , earlier. possible modify params hash it's different type of object , apparently cannot directly modified.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -