Sha256: 52e4496b41b4c3e680c82759241d72628fd6860b28be4c938c5758ddfd3b1ed8

Contents?: true

Size: 1.09 KB

Versions: 157

Compression:

Stored size: 1.09 KB

Contents

module Api::V1::Teams::ControllerBase
  extend ActiveSupport::Concern

  module StrongParameters
    # Only allow a list of trusted parameters through.
    def team_params
      strong_params = params.require(:team).permit(
        *permitted_fields,
        :name,
        :time_zone,
        :locale,
        # 🚅 super scaffolding will insert new fields above this line.
        *permitted_arrays,
        # 🚅 super scaffolding will insert new arrays above this line.
      )

      process_params(strong_params)

      strong_params
    end
  end

  included do
    load_and_authorize_resource :team, class: "Team", prepend: true,
      member_actions: (defined?(MEMBER_ACTIONS) ? MEMBER_ACTIONS : []),
      collection_actions: (defined?(COLLECTION_ACTIONS) ? COLLECTION_ACTIONS : [])

    private

    include StrongParameters
  end

  # GET /api/v1/teams
  def index
  end

  # GET /api/v1/teams/:id
  def show
  end

  # PATCH/PUT /api/v1/teams/:id
  def update
    if @team.update(team_params)
      render :show
    else
      render json: @team.errors, status: :unprocessable_entity
    end
  end
end

Version data entries

157 entries across 157 versions & 1 rubygems

Version Path
bullet_train-api-1.6.12 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.6.11 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.6.10 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.6.9 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.6.8 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.6.7 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.6.6 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.6.5 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.6.4 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.6.3 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.6.2 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.6.1 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.6.0 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.5.2 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.5.1 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.5.0 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.4.11 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.4.10 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.4.9 app/controllers/concerns/api/v1/teams/controller_base.rb
bullet_train-api-1.4.8 app/controllers/concerns/api/v1/teams/controller_base.rb