diff --git a/index.html b/index.html index df6000f3..dbb3d5a4 100644 --- a/index.html +++ b/index.html @@ -269,6 +269,7 @@
+ Loading Bootstrapped Models
+
+ When your app first loads, it's common to have a set of initial models that
+ you know you're going to need, in order to render the page. Instead of
+ firing an extra AJAX request to fetch them,
+ a nicer pattern is to have their data already bootstrapped into the page.
+ You can then use refresh to populate your
+ collections with the initial data. At DocumentCloud, in the
+ ERB template for the
+ workspace, we do something along these lines:
+
+<script> + Accounts.refresh(<%= @accounts.to_json %>); + Projects.refresh(<%= @projects.to_json(:collaborators => true) %>); +</script>