Migrated code to be Rails-Angularjs