Aug 22nd, 2011, 04:48 PM
appcontroller? alternatively: set variable for view globally
already posted this on grailsforum.co.uk, but it seems kind of inactive in general, so i am trying here.
i am writing my first application using grails, and coming from a cakephp background, there are some issues i am having.
the one which annoy me the most at the moment:
my layout has a menu which shows login and logout links. now, the login should only be shown when logged out, and vice versa. for this i am trying to create a appcontroller,
a controller which all other controllers inherit.
this concept (appcontroller / parent controller) seems to be absent when looking at documentation and examples for grails, which i really dont understand.
now, one can create a conroller called AppController and make other controllers inherit from it. but now i am creating a "def loggedIn = isLoggedIn()" in the appcontroller,
to check for this values contents in the layout view. this does not work and is not correctly inherited by the other controllers.
any ideas how one is supposed to pass such or similar variables to the view? it works if done for each controller, but i want it globally, for the appcontroller.