I would like to redirect from one action to another in a same controller.
Suppose I have a private method my_params
that returns an ActionController::Parameters
instance. It looks like { some_param: 'a', another_param: 'b' }
.
Let's say I want to redirect from :action_1
from :action_2
passing params
.
When I try to do redirect_to :action, my_params
, Rails complains:
syntax error, unexpected end-of-input, expecting keyword_end
Normally, I would write something like,
redirect_to :action, some_param: 'a', another_param: 'b'`
but I cannot do so in this case, because I want to pass my_params
.
Is there a Rails way to do this? Or any other suggestions?
Edit
This is not a duplicate because I want to pass in a param that is already an instance of ActionController::Parameters
.