maccman/spine — Issue #196: support for redirects in controller.active methods
Author: gr2m
Created: 2012-02-02 15:17:49+00:00
State: open

Under certain circumstances I need to have some security checks if the user has access to the controller, I put the logic for it into the controller's `active` method.

The problem is: when I call navigate within a `active` method, he start to run the `Spine.Manager::change` within the first call, it did not get aborted.

I'd suggest a change in the API: when an `active` method returns false the `Spine.Manager::change` method can be aborted.

The current code:

```coffeescript
class Spine.Manager extends Spine.Module
change: (current, args...) ->
for cont in @controllers
if cont is current
cont.activate(args...)
else
cont.deactivate(args...)
```

my suggestion
```coffeescript
class Spine.Manager extends Spine.Module
change: (current, args...) ->
for cont in @controllers
if cont is current
return if cont.activate(args...) is false
else
cont.deactivate(args...)
```

If you agree, I'd be happy to add specs and send a pull request