Sha256: 936c326e8a0b7931e070ee70a4fbdb34edbc90dabd831fd3724a745a7e5dac5d
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
module Clubhouse module Concerns module Controllers module OrganizationsController extend ActiveSupport::Concern def index render_list(authorize!(scoped)) end def create organization = authorize!(scoped.build) CreateOrganization.call({ organization: organization, user: current_user, params: whitelist(organization) }) render json: organization, status: :created end def check authorize!(fetch_organization) head :ok end def show organization = authorize!(fetch_organization) render json: organization, status: :ok end def update organization = authorize!(fetch_organization) organization.update!(whitelist(organization)) render json: organization, status: :ok end def destroy organization = authorize!(fetch_organization) organization.destroy head :no_content end private def scoped current_user.organizations end def fetch_organization Organization.locate!(params[:id]) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
clubhouse-0.1.0 | lib/clubhouse/concerns/controllers/organizations_controller.rb |