Introduce organization admins

This commit is contained in:
shlok007 2017-06-13 04:39:47 +05:30
parent f37d3095e1
commit b72e64b238
6 changed files with 96 additions and 41 deletions

View file

@ -1,6 +1,7 @@
module Admin
class OrganizationsController < Admin::BaseController
load_and_authorize_resource :organization
after_action :assign_role, only: :create
def index
@organizations = Organization.all
@ -45,6 +46,10 @@ module Admin
private
def assign_role
current_user.add_role :organization_admin, @organization
end
def organization_params
params.require(:organization).permit(:name, :description, :picture)
end