[LRUG] Tool to show included partials in RoR?

Tom Stuart tom at experthuman.com
Thu Jan 21 07:01:43 PST 2010


On 21 Jan 2010, at 14:25, Jocke Selin <jocke at selincite.com> wrote:
> point at a file in the app/views/ dir on my machine and it could render, ascii'ally of graphically, which files are "render partial" from there on. I'd like a tree with the file names

You can't do a good job of this in general, since the argument to #render can be an arbitrary Ruby expression (e.g. an ActiveRecord instance) rather than just the static filename of a partial, so you won't know what partial it's rendering without actually executing the template (and the application it lives in).

So maybe someone out there has written a tool that greps templates for "render :partial => '.*'" and "render '.*'" and builds a dependency tree from that, but if that technique alone is sophisticated enough to draw the graph you're looking for then you're luckier than me.

Cheers,
-Tom



More information about the Chat mailing list