Week 7, Day 2
Our project today had us exploring more ways to use Backbone.js, an awesome JavaScript library that can be used for making single page apps.
One shortcoming of Backbone is that it doesn't support the robust associations that models in Active Record support automatically. For example, if we said that a single RSS feed had many entries, you could simply write feed.entries in Rails to see a list of all of the entries associated with that feed. But this information isn't included in the JSON that's returned by Rails by default, and our backbone Feed model couldn't parse it even if it was.
So we rewrote the parse method for our Backbone Feed model, which allowed it to also instantiate an entire Backbone Entries collection using the information in our nested JSON. This means that, when we initially load the page, we get all the necessary data from our server at once, making navigating through different feeds incredibly fast.
I definitely want to try to use Backbone on my capstone project. Tomorrow we get even more practice with Backbone and nested views when we build a clone of Github Gist. Views inside of views...










