lib/aptible/rails/controller.rb in aptible-rails-0.6.4 vs lib/aptible/rails/controller.rb in aptible-rails-0.6.5
- old
+ new
@@ -42,12 +42,16 @@
token_subject || session_subject
end
# before_action :set_default_organization
def set_default_organization
- return current_organization if current_organization
+ return @current_organization if @current_organization
orgs = Aptible::Auth::Organization.all(token: session_token)
self.current_organization = orgs.first if orgs.any?
+ end
+
+ def clear_current_organization
+ delete_shared_cookie(:organization_url)
end
# before_action :authenticate_user
def authenticate_user
redirect_to Aptible::Rails.configuration.login_url unless current_user