aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/renderer/abstract_renderer.rb
Commit message (Collapse)AuthorAgeFilesLines
* Templates have one formatAaron Patterson2019-02-251-1/+1
| | | | | | | Templates only have one format. Before this commit, templates would be constructed with a single element array that contained the format. This commit eliminates the single element array and just implements a `format` method. This saves one array allocation per template.
* Ensure that rendered templates always have a formatAaron Patterson2019-02-221-3/+10
| | | | | This removes one call to `lookup_context` and also eliminates a conditional in `_render_template`.
* Fix up styleAaron Patterson2019-02-191-2/+2
|
* Return rendered template information instead of just stringsAaron Patterson2019-02-191-0/+48
| | | | | | | | | | | | This commit introduces "rendered template" and "rendered collection" objects. The template renderers can now return a more complex object than just strings. This allows the framework to get more information about the templates that were rendered. In this commit we use the rendered template object to set the "rendered_format" on the lookup context in the controller rather than all the way in the template renderer. That means we don't need to check the "rendered_format" every time we render a template, we just do it once after all templates have been rendered.
* Remove `with_layout_format` delegationAaron Patterson2019-01-281-1/+1
| | | | | That method doesn't exist on LookupContext, so the delegate doesn't make sense.
* Pull `@template` in to a local variableAaron Patterson2019-01-281-2/+0
| | | | | | This gets the PartialRenderer to be a bit closer to the TemplateRenderer. TemplateRenderer already keeps its template in a local variable.
* Remove `find_template` and `find_file` delegate methodsAaron Patterson2019-01-281-1/+1
| | | | | | | | | | This reduces the surface area of our API and removes a Liskov issue. Both TemplateRenderer and PartialRenderer inherit from AbstractRenderer, but since PartialRenderer implements it's own `find_template` that is private, and has the wrong method signature, an instance of PartialRenderer cannot be substituted for an instance of AbstractRenderer renderer. Removing the superclass implementation solves both issues.
* Use frozen string literal in actionview/Kir Shatrov2017-07-241-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Privatize unneededly protected methods in Action ViewAkira Matsuda2016-12-241-4/+4
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-15/+15
|
* modernizes hash syntax in actionviewXavier Noria2016-08-061-1/+1
|
* Lock down new `ImplicitRender` behavior for 5.0 RCGodfrey Chan2016-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]
* Instrument cached collection renders.Kasper Timm Hansen2016-02-201-2/+6
| | | | | | | | | | | | | | | | Augments the collection caching with some instrumentation that's logged. For collections that have been cached like: ```ruby <%= render partial: 'notifications/notification', collection: @notifications, cached: true %> ``` We'll output a line showing how many cache hits we had when rendering it: ``` Rendered collection of notifications/_notification.html.erb [0 / 100 cache hits] (3396.5ms) ```
* allow :file to be outside rails root, but anything else must be inside the ↵Aaron Patterson2016-01-221-1/+1
| | | | | | rails view directory CVE-2016-0752
* small refactors to actionview renderersEugene Gilburg2014-07-181-2/+4
|
* Move actionpack/lib/action_view* into actionview/libPiotr Sarnacki2013-06-201-0/+47