lib/aptible/rails/controller.rb in aptible-rails-0.5.3 vs lib/aptible/rails/controller.rb in aptible-rails-0.5.4
- old
+ new
@@ -25,9 +25,12 @@
return @current_organization if @current_organization
url = read_shared_cookie(:organization_url)
@current_organization = Aptible::Auth::Organization.find_by_url(
url, token: session_token
) if url
+ rescue HyperResource::ClientError => e
+ raise e unless e.body['code'] == 403
+ set_default_organization
end
def current_organization=(organization)
write_shared_cookie(:organization_url, organization.href)
end