Sha256: 351c8904851ca7a55e82acf600870d5db59a6a95f3a63e5fc756941dd6f212c9

Contents?: true

Size: 568 Bytes

Versions: 5

Compression:

Stored size: 568 Bytes

Contents

module Shipit
  class CommitsController < ShipitController
    def update
      if update_params[:locked].present?
        if Shipit::CastValue.to_boolean(update_params[:locked])
          commit.lock(current_user)
        else
          commit.unlock
        end
      end

      head :ok
    end

    private

    def commit
      @commit ||= stack.commits.find(params[:id])
    end

    def stack
      @stack ||= Stack.from_param!(params[:stack_id])
    end

    def update_params
      @update_params ||= params.require(:commit).permit(:locked)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
shipit-engine-0.31.0 app/controllers/shipit/commits_controller.rb
shipit-engine-0.30.0 app/controllers/shipit/commits_controller.rb
shipit-engine-0.29.0 app/controllers/shipit/commits_controller.rb
shipit-engine-0.28.1 app/controllers/shipit/commits_controller.rb
shipit-engine-0.28.0 app/controllers/shipit/commits_controller.rb