ActiveRecord functionality, brought in javascript