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,7 +1,17 @@
class Organization < ActiveRecord::Base
resourcify :roles, dependent: :delete_all
has_many :conferences, dependent: :destroy
after_create :create_roles
validates :name, presence: true
mount_uploader :picture, PictureUploader, mount_on: :picture
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)")
end
end