n8 / multi_fetch_fragments

Multi-fetch Fragments makes rendering and caching a collection of template partials easier and faster.
http://ninjasandrobots.com/rails-faster-partial-rendering-and-caching
MIT License
539 stars 63 forks source link

Dynamic partial name for cache in Rails 4? #30

Open netwire88 opened 9 years ago

netwire88 commented 9 years ago

With Rails 3 + Cache Digest + multi_fetch_fragments, I was able to do this:

=render partial: 'groups/group', collection: @results, as: :result, cache: true
And `groups/group` partial can support dynamic partial names, like this:
=render partial: "#{group.name}/#{group.name}", locals: {result: user}

However, after upgrading to Rails 4, I'm getting lots of Couldn't find template for digesting: "#{group.name}/#{group.name}" errors. I also tried:

- # Template Dependency: "#{group.name}/#{group.name}"
=render partial: "#{group.name}/#{group.name}", locals: {result: user}

But that's not working. Is this still supported?

travisp commented 9 years ago

@netwire88 those are just warnings. Nothing has changed, except Rails 4 is now telling you that it can't figure out the Template Dependencies (it couldn't before Rails 4 either). See the documentation for rails cache digests (this isn't a multi_fetch_fragments issue)