osem-fcy/app/models/organization.rb

18 lines
503 B
Ruby
Raw Normal View History

2017-05-31 18:42:52 +05:30
class Organization < ActiveRecord::Base
2017-06-13 04:39:47 +05:30
resourcify :roles, dependent: :delete_all
2017-06-06 20:04:39 +05:30
has_many :conferences, dependent: :destroy
2017-05-31 18:42:52 +05:30
2017-06-13 04:39:47 +05:30
after_create :create_roles
2017-05-31 18:42:52 +05:30
validates :name, presence: true
mount_uploader :picture, PictureUploader, mount_on: :picture
2017-06-13 04:39:47 +05:30
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
2017-05-31 18:42:52 +05:30
end