Fix activerecord integration