Last active
August 29, 2015 14:00
-
-
Save digitalplaywright/11362517 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Handlebars.registerHelper('can', function(permissionName, options){ | |
var rules = this.container.lookup('rules:eval'); | |
if ( options == null ){ | |
options = { activity: permissionName }; | |
}else{ | |
options['activity'] = permissionName; | |
} | |
return Ember.Handlebars.helpers.boundIf.call(rules, "can", options); | |
}); |
Gets error:
Uncaught TypeError: Cannot read property 'view' of undefined
Uncaught NotFoundError: Failed to execute 'setStartAfter' on 'Range': The node provided is null.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Helper inspired by http://livsey.org/blog/2012/10/16/writing-a-helper-to-check-permissions-in-ember-dot-js/