Apartment current_tenant resets to 'public' after failed devise login
<p>I use Devise for authentication and Apartment for multi-tenancy support on a SAAS app.</p>

<p>After a failed login, devise "redirects" to the login page (Users::SessionsController#new) and the value of <code>Apartment::Tenant.current</code> which was previously set in a <code>TenantElevator</code> middleware goes back to its default value of "public".</p>

<p>This is happening because Devise isn't actally redirecting to the login page but calling the FailureApp (which renders the login page) with a new rack env and returning its response. The new rack app doesn't have <code>TenantElevator</code> middleware so the tenant isn't set within the rack app.</p>

<p>Does anyone have any idea how to fix this? Maybe a way I can add the TenantElevator middleware to the Failure app?</p>