
If you have problems with beforeFilter
September 3, 2007I was having some problems trying to use the beforeFilter function in my controllers because I was using it in app_controller.php as well. In app_controller.php I was playing with the session variables and this was breaking when I went to use the beforeFilter function in any of my controllers. The workaround is very simple and came from the mailing list.
In you controller version of the beforeFilter function, add in the following line:
parent::beforeFilter();
before you do anything in the function. This explicitly calls the beforeFilter function in app_controller.php and runs it first.
Thanks to Jon Bennet for that little nugget
Perfect, just what I was looking for – thanks.
Excellent, glad to be of some help
I was seriously going crazy. Thanks!
It’s simple when you know how, and it makes sense when you think about it.
Thanks for the tip. Funny how things can be so obvious when you know how.
I wasted so much time before it! Thanks