70 lines
1.9 KiB
Ruby
70 lines
1.9 KiB
Ruby
class KeyBindsController < ApplicationController
|
|
before_action :set_key_bind, only: %i[ show edit update destroy ]
|
|
|
|
# GET /key_binds or /key_binds.json
|
|
def index
|
|
@key_binds = KeyBind.all
|
|
end
|
|
|
|
# GET /key_binds/1 or /key_binds/1.json
|
|
def show
|
|
end
|
|
|
|
# GET /key_binds/new
|
|
def new
|
|
@key_bind = KeyBind.new
|
|
end
|
|
|
|
# GET /key_binds/1/edit
|
|
def edit
|
|
end
|
|
|
|
# POST /key_binds or /key_binds.json
|
|
def create
|
|
@key_bind = KeyBind.new(key_bind_params)
|
|
|
|
respond_to do |format|
|
|
if @key_bind.save
|
|
format.html { redirect_to key_bind_url(@key_bind), notice: "Key bind was successfully created." }
|
|
format.json { render :show, status: :created, location: @key_bind }
|
|
else
|
|
format.html { render :new, status: :unprocessable_entity }
|
|
format.json { render json: @key_bind.errors, status: :unprocessable_entity }
|
|
end
|
|
end
|
|
end
|
|
|
|
# PATCH/PUT /key_binds/1 or /key_binds/1.json
|
|
def update
|
|
respond_to do |format|
|
|
if @key_bind.update(key_bind_params)
|
|
format.html { redirect_to key_bind_url(@key_bind), notice: "Key bind was successfully updated." }
|
|
format.json { render :show, status: :ok, location: @key_bind }
|
|
else
|
|
format.html { render :edit, status: :unprocessable_entity }
|
|
format.json { render json: @key_bind.errors, status: :unprocessable_entity }
|
|
end
|
|
end
|
|
end
|
|
|
|
# DELETE /key_binds/1 or /key_binds/1.json
|
|
def destroy
|
|
@key_bind.destroy
|
|
|
|
respond_to do |format|
|
|
format.html { redirect_to key_binds_url, notice: "Key bind was successfully destroyed." }
|
|
format.json { head :no_content }
|
|
end
|
|
end
|
|
|
|
private
|
|
# Use callbacks to share common setup or constraints between actions.
|
|
def set_key_bind
|
|
@key_bind = KeyBind.find(params[:id])
|
|
end
|
|
|
|
# Only allow a list of trusted parameters through.
|
|
def key_bind_params
|
|
params.require(:key_bind).permit(:setup_id, :key_id, :batch_id)
|
|
end
|
|
end
|