ActiveRecord pattern for AngularJS