activerecord memory issue