integrate with rails model and query object