Moved Rails wrapper code to before call