ActiveRecord/postgres implementation stuff