Class: Api::OrganizationsController

Inherits:
BaseController
  • Object
show all
Includes:
OrganizationsControllerTemplate
Defined in:
app/controllers/api/organizations_controller.rb

Instance Method Summary collapse

Methods included from OnBaseOrganizationOnly

#ensure_base_organization!

Methods included from Mumuki::Laboratory::Controllers::CurrentOrganization

#organization_name, #set_current_organization!, #visit_organization!

Methods included from Mumuki::Laboratory::Controllers::DynamicErrors

#bad_record, #blocked_forum, #disabled, #disabled_organization, #forbidden, #gone, #internal_server_error, #not_found, #render_error, #unauthorized, #unprepared_organization

Instance Method Details

#authorization_slugObject



25
26
27
# File 'app/controllers/api/organizations_controller.rb', line 25

def authorization_slug
  '_/_'
end

#createObject



15
16
17
18
# File 'app/controllers/api/organizations_controller.rb', line 15

def create
  @organization.save!
  render json: @organization.to_resource_h
end

#indexObject



7
8
9
# File 'app/controllers/api/organizations_controller.rb', line 7

def index
  render json: { organizations: Organization.accessible_as(current_user, :janitor) }
end

#showObject



11
12
13
# File 'app/controllers/api/organizations_controller.rb', line 11

def show
  render json: @organization.to_resource_h
end

#updateObject



20
21
22
23
# File 'app/controllers/api/organizations_controller.rb', line 20

def update
  @organization.update! organization_params
  render json: @organization.to_resource_h
end