Skip to content

Instantly share code, notes, and snippets.

@rrmartins
Created May 25, 2012 16:23
Show Gist options
  • Save rrmartins/2789019 to your computer and use it in GitHub Desktop.
Save rrmartins/2789019 to your computer and use it in GitHub Desktop.
:manage Cancan
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