swapping activerecord for rails