1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

20 commits

Author SHA1 Message Date
Sam Stephenson
1a404abc03 Remove ActionView::Helpers::CacheHelper#fragment_cache_key
Introduced in e56c635427, `CacheHelper#fragment_cache_key` is a duplicate of `ActionController::Caching::Fragments#fragment_cache_key`.

We now require the view to provide this method on its own (as with `view_cache_dependencies`); `ActionController::Caching::Fragments` exports its version as a `helper_method`.
2015-12-14 17:57:39 -06:00
Lachlan Sylvester
a9c6a583b6 Fix calling cache helper with a relation 2015-08-28 17:26:09 +10:00
Kasper Timm Hansen
a6509d3112 Add wildcard template dependencies. 2015-07-26 19:21:14 +02:00
Dov Murik
5a41d00455 Support explicit defintion of resouce name for collection caching.
If a template includes `# Template Collection: ...` anywhere in its
source, that name will be used as the cache name for the partial that is
rendered for the collection.

This allows users to enable collection caching even if the template
doesn't start with `<% cache ... do %>`.

Moreover, the `# Template Collection: ...` notation is recognized in all
template types (and template types other than ERB can define a
resource_cache_call_pattern method to allow the `cache ... do` pattern
to be recognized too).
2015-07-07 16:57:09 -04:00
Roque Pinel
da1674576d Fix cache issue when different partials use the same collection
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.
2015-06-28 20:41:59 -05:00
Robin Dupret
0b57f090c9 Tiny documentation edits [ci skip] 2015-06-09 11:49:33 +02:00
Gourav Tiwari
333ecdcb56 Better formatted documents [ci skip] 2015-05-08 10:15:36 -07:00
Javan Makhmali
20f6f646d1 Make ActionMailer #cache helper a no-op, not an exception 2015-04-28 13:56:42 -06:00
Rafael Mendonça França
68a2a67116 Merge pull request #18948 from kaspth/automatic-collection-caching
Merge multi_fetch_fragments.
2015-02-25 11:54:07 -03:00
Kasper Timm Hansen
11644fd0ce Collections automatically cache and fetch partials.
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 %>
```
2015-02-21 16:06:57 +01:00
Kasper Timm Hansen
e56c635427 Merge multi_fetch_fragments.
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.
2015-02-20 20:07:50 +01:00
Anthony Dmitriyev
421865e4fd Fix cache_helper comment ERB 2015-02-20 17:04:35 +00:00
Vipul A M
73bfb51011 Change links to 37signals and svn blog to point to new destinations. [ci skip] 2014-04-12 12:46:04 +05:30
David Heinemeier Hansson
637bb726ca Digestor should just rely on the finder to know about the format and the variant -- trying to pass it back in makes a mess of things (oh, and doesnt work) 2014-03-21 19:38:59 +01:00
Piotr Chmolowski
025c691536 Ensure LookupContext in Digestor selects correct variant
Related to: #14242 #14243 14293

Variants passed to LookupContext#find() seem to be ignored, so
I've used the setter instead: `finder.variants = [ variant ]`.

I've also added some more test cases for variants. Hopefully this
time passing tests will mean it actually works.
2014-03-09 08:47:17 +01:00
Piotr Chmolowski
1858cc6070 Variants in ActionView::Digestor
Take variants into account when calculating template digests in
ActionView::Digest.

Digestor#digest now takes a hash as an argument to support variants and
allow more flexibility in the future. Old-style arguments have been
deprecated.

Fixes #14242
2014-03-04 15:02:58 +01:00
Rajarshi Das
414f496363 fix the typo [ci skip]
fix the typo newstopics => new topics in action view cache helper
2013-09-02 10:41:55 +05:30
Carlos Antonio da Silva
f410c13bf8 Refactor cache fragment handling with read/write methods 2013-06-25 20:51:02 -03:00
Andrew Rove
f341acdae3 Move the write portion of fragment_for to its own method to allow for easier creation of custom cache methods. 2013-06-25 20:46:02 -03:00
Piotr Sarnacki
0d6e8edc2a Move actionpack/lib/action_view* into actionview/lib 2013-06-20 17:23:15 +02:00
Renamed from actionpack/lib/action_view/helpers/cache_helper.rb (Browse further)