aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/renderer/partial_renderer
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Use mattr_accessor default: option throughout the projectGenadi Samokovarov2017-06-031-1/+1
|
* Use recyclable cache keys (#29092)David Heinemeier Hansson2017-05-181-1/+1
|
* Bring back support for callable cache_key on collection renderingIgnatius Reza2016-07-211-1/+7
|
* Instrument cached collection renders.Kasper Timm Hansen2016-02-201-2/+3
| | | | | | | | | | | | | | | | 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) ```
* Make collection caching explicit.Kasper Timm Hansen2016-02-201-26/+11
| | | | | | | | | | | | Having collection caching that wraps templates and automatically tries to infer if they are cachable proved to be too much of a hassle. We'd rather have it be something you explicitly turn on. This removes much of the code and docs to explain the previous automatic behavior. This change also removes scoped cache keys and passing cache_options.
* Prefer empty? to any?.Kasper Timm Hansen2016-02-121-1/+1
| | | | | | | 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.
* Stop mutating return value.Kasper Timm Hansen2016-02-121-2/+3
| | | | | | `PartialRenderer.render_collection_with/without_template` returns an array of rendered partials. Avoid dup'ing and shifting it by indexing into the collection instead.
* Inline `fetch_or_cache_partial`.Kasper Timm Hansen2016-02-121-10/+6
| | | | Wasn't pulling its weight for a simple yield anymore.
* Write to collection cache where the template is rendered.Kasper Timm Hansen2016-02-121-9/+8
| | | | | | | | 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.
* Only write to collection cache if we have a callable cache key.Kasper Timm Hansen2016-02-121-1/+5
| | | | | | | | | | | 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.
* Remove useless callable_cache_key? check.Kasper Timm Hansen2016-02-121-2/+1
| | | | | | `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.
* Remove single_template_render? method.Kasper Timm Hansen2016-02-121-5/+1
| | | | | | 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.
* Don't search in locals for cache_options.Kasper Timm Hansen2016-02-121-3/+1
| | | | | | 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.
* Fix cache issue when different partials use the same collectionRoque Pinel2015-06-281-1/+1
| | | | | | | | | 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.
* spelling fix [ci skip]karanarora2015-05-191-1/+1
|
* Collections automatically cache and fetch partials.Kasper Timm Hansen2015-02-211-2/+15
| | | | | | | | | | | | | | | | | | | | | | | 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 %> ```
* Merge multi_fetch_fragments.Kasper Timm Hansen2015-02-201-0/+57
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.