PagesController.before('*', fn) and PagesController.after('*', fn) do not work if not defined at end of controlelr

31 views
Skip to first unread message

Arjon Buikstra

unread,
Dec 5, 2013, 8:23:26 AM12/5/13
to locomo...@googlegroups.com
This is just a note, maybe to add to documentation, maybe so other people find out quicker:

The before and after functions for controller should be the last to be included in a controller. I was used to defining them at the top, and didn't get why they were not firing. Turned out controller._actions() only retrieves the functions defined before the filters were defined in the controller, and this is the function that gets called when giving a wildcard for before and after.

Jared Hanson

unread,
Dec 5, 2013, 11:15:57 AM12/5/13
to locomo...@googlegroups.com
This is no longer the case in 0.4.x, which is being developed on the master branch and will be released shortly.


On Thu, Dec 5, 2013 at 5:23 AM, Arjon Buikstra <arjonb...@gmail.com> wrote:
This is just a note, maybe to add to documentation, maybe so other people find out quicker:

The before and after functions for controller should be the last to be included in a controller. I was used to defining them at the top, and didn't get why they were not firing. Turned out controller._actions() only retrieves the functions defined before the filters were defined in the controller, and this is the function that gets called when giving a wildcard for before and after.

--
You received this message because you are subscribed to the Google Groups "Locomotive" group.
To unsubscribe from this group and stop receiving emails from it, send an email to locomotivejs...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Jared Hanson <http://jaredhanson.net/>

Arjon Buikstra

unread,
Dec 6, 2013, 5:38:41 AM12/6/13
to locomo...@googlegroups.com
Awesome! I'll be sure to check out the solution, I could imagine it may not be so easy :) good work.

Sadly for my current project we won't be able to use the new version, but it's always nice to hear about active developments for future projects. I'll try to help out where I can (as soon as my proficiency has increased)
Reply all
Reply to author
Forward
0 new messages