lib/aptible/rails/controller.rb in aptible-rails-0.2.0 vs lib/aptible/rails/controller.rb in aptible-rails-0.3.0
- old
+ new
@@ -24,10 +24,12 @@
rescue
clear_session_cookie
end
def current_organization
- @current_organization ||= auth.organizations.first
+ session[:organization_url] ||= auth.organizations.first.href
+ Aptible::Auth::Organization.find_by_url(session[:organization_url],
+ token: service_token)
end
def service_token
return unless aptible_token && aptible_token.session
@service_token ||= service_token_for(aptible_token)