Skip to content

Instantly share code, notes, and snippets.

@davidray
Created October 25, 2012 17:35
Show Gist options
  • Save davidray/3954218 to your computer and use it in GitHub Desktop.
Save davidray/3954218 to your computer and use it in GitHub Desktop.
Let's say I have an index view with this kind of hierarchy...
= render sidebar #no caching
= render partial:patrol, collection:@patrols #has a cache key for patrol
= render partial:users, collection:patrol.users #has a cache key for user
rake cache_digests:nested_dependencies TEMPLATE=manage/manage/index
[
"manage/manage/sidebar", #Didn't expect this because I don't cache it (yet)
{
"manage/manage/users": [
{
"manage/manage/patrol": [ #Expected this
"manage/manage/user", #Expected this
"manage/manage/add_new_member" #Expected this
]
},
"manage/manage/add_new_member" #Expected this
]
}
]
I sort of expected it to only list the dependencies for which I had set up cacheing, rather than all the dependencies it could figure out.
@davidray
Copy link
Author

The second file is just pseudo-code to show the index page's rendering hierarchy. I added comments to show what I expected and didn't expect as output. I hope this makes sense.

Now that I understand that the rake task shows all the view dependencies whether or not the partials are cached, it makes sense and I think the rake task is correct. I was just wondering if the rake task should be explained in a way that people will not be confused as I was.

@dhh
Copy link

dhh commented Oct 25, 2012

Ah, I see. Yeah, there's no way of doing that. This just shows the nested dependencies between templates. That's by design. Feel free to see if you can improve the message, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment