It should also document using plug :put_view, View to change the implicit view used in the whole controller - it's very useful but I don't think it's very popular. I only realised you could do that after reading through the code for how phoenix sets the default view when you use Phoenix.Controller.
Yeah, the automatic view selection confused the hell out of me when I started using Phoenix. I just accepted that it works how it works now.
Whomever takes this on should also update the guides, should be a fairly easy find and replace for render. The trickier part will be explaining the new put_view, and removing reference to passing a View to render.
I'd love to tackle this one, is it OK if I do a PR with a work in progress? Cause I think it's gonna take me some time given the number of places these functions are referenced.
@evuez yes, please go ahead. :)
Just curious, what was the reasoning behind this? No strong feeling either way but I'm trying to understand why it was deprecated.
@stevedomin I think our clauses were laid out in a way where you could pass a template where a view was expected or vice-versa because we were matching on the type and that can be a security issue if people are not careful. I mean, people would have to already be doing something wrong, but better to be safer and keep the API simple.
Makes a lot of sense. Thanks @josevalim
Most helpful comment
It should also document using
plug :put_view, Viewto change the implicit view used in the whole controller - it's very useful but I don't think it's very popular. I only realised you could do that after reading through the code for how phoenix sets the default view when youuse Phoenix.Controller.