See http://richonrails.com/articles/getting-started-with-angularjs-and-rails for details.