According to the docs:
redirect_back(fallback_location:, allow_other_host: true, **args)
:fallback_location
- The default fallback location that will be used on missingReferer
header.:allow_other_host
- Allow or disallow redirection to the host that is different to the current host, defaults to true.
All other options that can be passed to redirect_to are accepted as options and the behavior is identical.
And redirect_to
allows me to add params to the url just by passing them as a hash
So, why do none of these work for me:
redirect_back fallback_location: tasks_path, allow_other_host: false, syncing: true
redirect_back fallback_location: tasks_path, allow_other_host: false, { syncing: true }
redirect_back fallback_location: tasks_path, allow_other_host: false, options: { syncing: true }
redirect_back(fallback_location: tasks_path, allow_other_host: false, options: { syncing: true })
redirect_back(fallback_location: tasks_path, allow_other_host: false, syncing: true)
...and any other iteration on the above that I could think of.
All of them (that are valid code), just return me back without the added parameter
I'm trying to achieve this URL:
(back_url or fallback_location) + '?syncing=true'
If you look at the source code for redirect_back
you will see, that it essentially uses redirect_to "whatever_url.com"
version of redirect_to
method.
If you check the explanation of redirect_to you can see that in this use case you unfortunately cannot pass any arguments. If this is super needed, I guess you could just override the redirect_back
method to append params option to the url with string concatenation, but that seems like a nasty fix.
But to answer your question - what you want to achieve seems to be impossible out of the box.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With