I checked out the source and it doesn't seem like that's possible. Is this something that's PR worthy? Should a current template be re-rendered instead or something?
Looks like Rails now advocates using redirect_back with a required fallback location param, instead of redirect_to :back. I think this a better approach, since not all web clients send the Referer header, and we need to have a back-up plan.
I'm open to this, but it's also really easy for people to implement themselves. Something like: redirect_to request.headers["Referer"] || fallback_url
What do others think?
I agree that it's easy to implement it if needed, but it would be a good idea to document it somewhere. I've not had a lot of use cases where a redirect back was necessary...
@vladdypwnz basically, when a submission fails, you should re-render the template, not redirect back, otherwise you'll lose your form errors
One of the only redirect back use case is on user login within the page where he must go back, but it's better handled with either a session or url param, in case the user enters a wrong password...
I am with @TiteiKo on this. It is pretty trivial to implement. The question is should we? There are certain patterns that Rails advocates that has proven not-so-good practice. I am open for more input if this pattern proves useful.
I also agree with @TiteiKo. We should document this feature, not implement it. Implementing a half-baked (because it requires a fallback URL for when 'referer' isn't set) solution seems like a bad idea. The doc note could go here: http://hanamirb.org/guides/actions/control-flow/ ?
@cllns Do you want me to include this in the docs. I agree this is too trivial for a framework support. It should be left to dev to implement really.
Go for it @theCrab :) Thanks
@vladdypwnz
Should a current template be re-rendered instead or something?
yes
Because you all voted against it, I'm removing the feature label and closing it.
Most helpful comment
I agree that it's easy to implement it if needed, but it would be a good idea to document it somewhere. I've not had a lot of use cases where a redirect back was necessary...
@vladdypwnz basically, when a submission fails, you should re-render the template, not redirect back, otherwise you'll lose your form errors
One of the only redirect back use case is on user login within the page where he must go back, but it's better handled with either a session or url param, in case the user enters a wrong password...