function(head, req) { // !code path.js // !code mustache.js // !json templates/layout.mustache // !json templates/<%= pluralized_model_name %>/index.mustache provides("html", function() { var view = { path: path(), title: "Listing <%= pluralized_model_name.humanize %>", body: { path: path(), rows: function() { var rows = []; var row; while (row = getRow()) { rows.push({ <% attributes.each do |attribute| -%> <%= attribute %>: row.value['<%= attribute %>'], <% end -%> id: row.id }); } return rows; } } }; Mustache.to_html(templates.layout, view, { body: templates.<%= pluralized_model_name %>.index }, function(line) { send(line + "\n"); }); }); }