Based on Angular.js tutorial at http://coderberry.me/blog/2013/04/23/angularjs-on-rails-4-part-2/