change ActiveRecord calls to instance variable calls