Last active
August 29, 2015 14:11
-
-
Save jsmestad/0de0281a01fc18d416fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def current_user=(val) | |
session[:signed_token] = @user | |
@user = User.find(....) | |
@user.signing_token = session[:signed_token] | |
end | |
class User | |
#... | |
def signing_middleware | |
(conn) -> { | |
use :headers, 'X-Signing-Token' => self.signing_token | |
} | |
end | |
def domains | |
Account.middleware do |conn| | |
self.signing_middleware.call(conn) | |
end | |
Account.find(account_ref: self.account_id) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AssessmentScope.signing_token = -> { current_user.signing_token } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment