How to authorize namespace, model-less controllers using CanCanCan?
问题 What is the correct way to authorize and check abilities for a namespaced, model-less controller using CanCanCan? After much googling and reading the wiki, I currently have #controllers/namespaces/unattacheds_controller.rb def Namespaces::UnattachedsController authorize_resource class: false def create # does some stuff end end #models/ability.rb def admin can [:create], :namespaces_unattacheds end #view/ <%= if can? :create, :namespaces_unattacheds %> # show a create form to authorized users