mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
17 lines
438 B
Ruby
17 lines
438 B
Ruby
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
|
|
roles.where(name: 'organization_admin').first_or_create(description: 'For the administrators of an organization and its conferences')
|
|
end
|
|
end
|