aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/implicit_render.rb
Commit message (Collapse)AuthorAgeFilesLines
* Refinement of our "are you missing a template or did you omit it on ↵Jeremy Daer2016-03-031-53/+34
| | | | | | | | | | | | | | | | | | | | purpose?" heuristics Narrows the "are you in a browser, viewing the page?" check to exclude non-GET requests. Allows content-less APIs to use implicit responses without having to set a fake request format. This will need further attention. If you forget to redirect from a POST to a GET, you'll get a 204 No Content response that browsers will typically treat as… do nothing. It'll seem like the form just didn't work and knowing where to start debugging is non-obvious. On the flip side, redirecting from POST and others is the default, done everywhere, so it's less likely to be removed or otherwise missed. Alternatives are to do more explicit browser sniffing. Ref #23827.
* Fix typo in implicit_renderMax Woolf2016-03-021-1/+1
| | | When trying to make a request and the request doesn't have a suitable template, the new error messages are really helpful but there's a small (and I mean, VERY small) typo that has been bugging me for the last few days. This adds the space and restores order to the universe. :heart:
* Additional review of 6b31761.Kasper Timm Hansen2016-02-251-1/+1
| | | | | * Fixes typos in error message and release notes. * Removes unused template test file.
* Lock down new `ImplicitRender` behavior for 5.0 RCGodfrey Chan2016-02-251-17/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Conceptually revert #20276 The feature was implemented for the `responders` gem. In the end, they did not need that feature, and have found a better fix (see plataformatec/responders#131). `ImplicitRender` is the place where Rails specifies our default policies for the case where the user did not explicitly tell us what to render, essentially describing a set of heuristics. If the gem (or the user) knows exactly what they want, they could just perform the correct `render` to avoid falling through to here, as `responders` did (the user called `respond_with`). Reverting the patch allows us to avoid exploding the complexity and defining “the fallback for a fallback” policies. 2. `respond_to` and templates are considered exhaustive enumerations If the user specified a list of formats/variants in a `respond_to` block, anything that is not explicitly included should result in an `UnknownFormat` error (which is then caught upstream to mean “406 Not Acceptable” by default). This is already how it works before this commit. Same goes for templates – if the user defined a set of templates (usually in the file system), that set is now considered exhaustive, which means that “missing” templates are considered `UnknownFormat` errors (406). 3. To keep API endpoints simple, the implicit render behavior for actions with no templates defined at all (regardless of formats, locales, variants, etc) are defaulted to “204 No Content”. This is a strictly narrower version of the feature landed in #19036 and #19377. 4. To avoid confusion when interacting in the browser, these actions will raise an `UnknownFormat` error for “interactive” requests instead. (The precise definition of “interactive” requests might change – the spirit here is to give helpful messages and avoid confusions.) Closes #20666, #23062, #23077, #23564 [Godfrey Chan, Jon Moss, Kasper Timm Hansen, Mike Clark, Matthew Draper]
* Override default_render's behavior with a blockDave Copeland2015-06-201-2/+17
| | | | | | | | | | In 0de4a23 the behavior when there is a missing template was changed to not raise an error, but instead head :no_content. This is a breaking change and some gems rely on this happening. To allow gems and other code to work around this, allow `default_render` to take a block which, if provided, will execute the contents of that block instead of doing the `head :no_content`.
* Return 204 if render is not called in API controllersJorge Bejar2015-06-111-6/+3
|
* Fix ActionPack tests after changes to missing template loggereileencodes2015-04-061-1/+1
| | | | | | | | | After merging #19377 ActionPack tests were missing a require for `ActiveSupport::LogSubscriber::TestHelper` and change didn't take into account that logger could be nil. Added the require and only log to info if logger exists. This wasn't caught earlier because these tests only run after a merge.
* head no_content when there is no template or action performedStephen Bussey2015-04-051-1/+6
|
* Use performed? instead of checking for response_bodyCarlos Antonio da Silva2012-01-191-1/+1
| | | | | | * Check for performed? instead of response_body * Change performed? to return a boolean * Refactor AC::Metal#response_body= to reuse variable
* Revert to old semantics, use available_action? instead of action_method?.José Valim2011-05-061-9/+7
|
* pass respond_with options to controller render when using a template for api ↵Josh Kalderimis2011-03-311-2/+2
| | | | | | navigation Signed-off-by: José Valim <jose.valim@gmail.com>
* Make action_method? public and change implicit rendering to override it instead.José Valim2011-03-301-4/+2
|
* Pass the proper method_name instead of hardcoding to action_name.José Valim2011-03-291-8/+10
| | | | | | Conflicts: actionpack/lib/action_controller/metal/implicit_render.rb
* #948 template_inheritanceartemave2010-12-261-2/+2
|
* Finally moved the find template logic to the views.José Valim2010-03-081-1/+1
|
* Move layout lookup to views.José Valim2010-03-081-2/+1
|
* Added template lookup responsible to hold all information used in template ↵José Valim2010-03-071-0/+1
| | | | lookup.
* Actually move ImplicitRender into it's own fileCarl Lerche2010-03-031-0/+21