Created
May 25, 2012 16:23
-
-
Save rrmartins/2789019 to your computer and use it in GitHub Desktop.
:manage Cancan
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
permissions = Permission.find_all_by_group_id(<id_do_grupo_do_usuario>) | |
cannot :manage, :all | |
actions = "" | |
models = "" | |
# dps vai verificando as permissoes do usuario, e permitindo. tipo: | |
permissions.each do |permission| | |
actions = permission.action | |
models = permission.model.singularize.constantize | |
can actions, models | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment