Skip to content
Discussion options

You must be logged in to vote

The config() definition is cached, so if you set request.foo = 1 within config() directly, it will only be run once, when the controller is initialised (so only a ?reload=true / application restart will re-examine it).

What you can do is use a filter to setup things, which, whilst the config() function is cached, will get run.

i.e,

function config(){
  filters(through="setDefaults");
}

private function setDefaults(){
  // I will get executed on each request
  request.foo = 1;
}

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
10 replies
@bpamiri
Comment options

@cfcoder
Comment options

@cfcoder
Comment options

@neokoenig
Comment options

Answer selected by cfcoder
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants