Skip to content

Instantly share code, notes, and snippets.

@w1shen
Last active August 29, 2015 14:03
Show Gist options
  • Save w1shen/ed7b2f939030a8a74d96 to your computer and use it in GitHub Desktop.
Save w1shen/ed7b2f939030a8a74d96 to your computer and use it in GitHub Desktop.
Lift Session-and-Request

http://exploring.liftweb.net/master/index-3.html#sec:Session-and-Request

One important thing to note is that the injector variable is called in the scope of the following request. This means that if you want the value returned by the function at the point where you call the link or redirectTo, you’ll need to capture it in a val. Otherwise, the function will be called after the redirect or link, which may result in a different value than you expect. As you can see in Listing 3.11↑, we set up an acct val in our doSave method prior to redirecting. If we tried to do something like

S.redirectTo("/view", () => currentAccountVar(currentAccountVar.is))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment