diff --git a/app/controllers/admin/organizations_controller.rb b/app/controllers/admin/organizations_controller.rb index 9d0dc78b..087bf7f8 100644 --- a/app/controllers/admin/organizations_controller.rb +++ b/app/controllers/admin/organizations_controller.rb @@ -1,7 +1,6 @@ module Admin class OrganizationsController < Admin::BaseController load_and_authorize_resource :organization - after_action :assign_role, only: :create def index @organizations = Organization.all @@ -46,10 +45,6 @@ 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 diff --git a/app/models/organization.rb b/app/models/organization.rb index 0fdbe5f9..de3d4f94 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -12,6 +12,6 @@ class Organization < ActiveRecord::Base private def create_roles - Role.where(name: 'organization_admin', resource: self).first_or_create(description: "For the administrators of an organization (who shall have full access to the organization and it's conferences)") + roles.where(name: 'organization_admin').first_or_create(description: 'For the administrators of an organization and its conferences') end end diff --git a/lib/tasks/roles.rake b/lib/tasks/roles.rake index 227f9642..c29d0e24 100644 --- a/lib/tasks/roles.rake +++ b/lib/tasks/roles.rake @@ -3,7 +3,7 @@ namespace :roles do task add: :environment do Organization.all.each do |org| - Role.where(name: 'organization_admin', resource: org).first_or_create(description: "For the administrators of an organization (who shall have full access to the organization and it's conferences)") + Role.where(name: 'organization_admin', resource: org).first_or_create(description: 'For the administrators of an organization and its conferences') end Conference.all.each do |c|