Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Would it make sense to accept a proc as a way to specify explicit dependencies? #62

Closed
peternixey opened this issue Jul 3, 2014 · 1 comment

Comments

@peternixey
Copy link

We're building an application that allows the users to create their own templates for sections of the app. This is similar to Shopfiy or Wordpress - users can create themes which have multiple templates.

However this makes it hard to deal with the explicit dependencies in cache_digests. The format <%# Template Dependency: todolists/todolist %> doesn't allow for a dynamically changing set of template dependencies.

I was wondering whether a proc would be a reasonable way to return a set of templates that the container template depends on?

<%# Template Dependency: { | h | h.return_dependent_templates } %>

It's taking me a while to wrap my head around the implications of this and whether this in fact the right approach or whether it just starts to break everything from the inside out. I wanted to just raise it and see your thoughts.

There's another example of a slightly different version of this problem in this stack overflow question.

@peternixey peternixey changed the title Would it make sense to accept a proc for external dependencies? Would it make sense to accept a proc as a way to specify explicit dependencies? Jul 3, 2014
@peternixey
Copy link
Author

I'm self-closing this on the premise that the templates are either

a) a part of the file system in which case you can manually add them in using the commenting
or
b) completely dynamic and stored in the database in which case they can just be treated as if they were any other piece of data.

I think this is correct

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant