| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
If the collection isn't empty any? will loop through it.
Spare the loop and be more concise with what we're asking the
collection about.
|
|
|
|
|
|
| |
`PartialRenderer.render_collection_with/without_template` returns an array
of rendered partials. Avoid dup'ing and shifting it by indexing into
the collection instead.
|
|
|
|
| |
Wasn't pulling its weight for a simple yield anymore.
|
|
|
|
|
|
|
|
| |
Moves us closer to having access to a local template variable,
we can ask for eligibility and its virtual_path.
Currently we rely on `@template`, which we don't have available
when rendering collections without a fixed template.
|
|
|
|
|
|
|
|
|
|
|
| |
A callable cache key writes to the collection cache under a certain namespace.
Which means if we don't have scoped cache key we can just rely on the
`cache model_name do` in the templates to cache them.
Less writes, more sharing.
Add `assert_customer_cached` to better illustrate this in tests, and remove
tests which then don't communicate as much.
|
|
|
|
|
|
| |
`automatic_cache_eligible?´ is only called if there was no `:cache` key
to fetch in the `@options` via `cache_collection?`. So the check will
always be false.
|
|
|
|
|
|
| |
Written when I didn't understand the internals as well. Action View
generally just refers to `@template` when meaning a fixed template
render. So follow that implicit convention.
|
|
|
|
|
|
| |
We should only support a top level `cache_options`. We also don't
have to default the options to a hash as Active Support's cache
defaults that arg to nil.
|
|
|
|
|
|
| |
rails view directory
CVE-2016-0752
|
|\ |
|
| | |
|
| |
| |
| |
| |
| | |
This commit fixes the bug convering `false` to `locals[as]` when
`options[:object]` is `false` (close #22260).
|
|/ |
|
|
|
|
|
|
|
| |
The thread_safe gem is being deprecated and all its code has been merged
into the concurrent-ruby gem. The new class, Concurrent::Map, is exactly
the same as its predecessor except for fixes to two bugs discovered
during the merge.
|
|
|
|
|
|
|
|
| |
Before we were changing the state of the lookup_context for the duration
of the with_layout_format block, but since we already know the formats
we can just pass it explicitly.
Related with 8d7ce0f22aee09d20091a4dc58cb379a09d13e26
|
| |
|
|
|
|
| |
explicitely.
|
| |
|
|
|
|
|
|
|
|
|
| |
Adds the `virtual_path` option to `cache_fragment_name` so it can
be provided when needed.
That allows `cache_collection_render` to get the appropriate cache
key with the digest generated based on the template and prevent
collision with other templates that cache the same collection.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
When one rendered a partial template without specifying an object
or a collection (e.g. <%= render partial: 'partial_name' %>), Rails
would make an object called :partial_name available in local_assigns.
I don't think this was the intended behavior, since no local variable
called 'partial_name' gets defined in the view.
|
|\
| |
| | |
[ci skip] Unify the code comment in ActionView::Renderer#render_template...
|
| | |
|
|/ |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Collections can take advantage of `multi_read` if they render one template
and their partials begin with a cache call.
The cache call must correspond to either what the collections elements are
rendered as, or match the inferred name of the partial.
So with a notifications/_notification.html.erb template like:
```ruby
<% cache notification %>
<%# ... %>
<% end %>
```
A collection would be able to use `multi_read` if rendered like:
```ruby
<%= render @notifications %>
<%= render partial: 'notifications/notification', collection: @notifications, as: :notification %>
```
|
|
|
|
|
|
|
|
| |
Makes caching a collection of template partials faster using `read_multi`
on the Rails cache store.
Some caching implementations have optimized `read_multi` so we don't have
to check in the cache store for every template.
|
|
|
|
| |
because the partial renderer would not create an lvar per each template since c67005f221f102fe2caca231027d9b11cf630484
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
The "Rendering" word in the titles is not meant to be a link to
the documentation for ActionView::Rendering.
[ci skip]
|
|/
|
|
|
| |
before this PR IDENTIFIER_ERROR_MESSAGE could lead to misunderstand the convention of partial name.
Added OPTION_AS_ERROR_MESSAGE for unvalid charter in as option.
|
|
|
|
| |
Originally caused by #17771
|
|
|
|
|
|
|
|
|
|
|
|
| |
c67005f221f102fe2caca231027d9b11cf630484 made the local var in partials
available only if what passed to `:object` was truthy.
For example this would not make the local variable `foo` available inside the
partial:
render partial: 'foo', object: false
Fixes #17373.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This class is only used on the PartialRenderer.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The iteration object is available as the local variable
"template_name_iteration" when rendering partials with collections.
It gives access to the +size+ of the collection beeing iterated over,
the current +index+ and two convinicence methods +first?+ and +last?+
"template_name_counter" variable is kept but is deprecated.
[Joel Junström + Lucas Uyezu]
|
|
|
|
|
|
|
|
|
| |
This is an option for to HTML content with a content type of
`text/html`. This rendering option calls `ERB::Util.html_escape`
internally to escape unsafe HTML string, so you will have to mark your
string as html safe if you have any HTML tag in it.
Please see #12374 for more detail.
|
|
|
|
|
|
|
|
| |
This is as an option to render content with a content type of
`text/plain`. This is the preferred option if you are planning to render
a plain text content.
Please see #12374 for more detail.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is an option for sending a raw content back to browser. Note that
this rendering option will unset the default content type and does not
include "Content-Type" header back in the response.
You should only use this option if you are expecting the "Content-Type"
header to not be set. More information on "Content-Type" header can be
found on RFC 2616, section 7.2.1.
Please see #12374 for more detail.
|
| |
|
| |
|
|
|
|
| |
:content_type option. Closes #11393.
|
|
|