class WheelOptionsController < ApplicationController before_action :set_wheel_option, only: %i[ show edit update destroy ] # GET /wheel_options or /wheel_options.json def index @wheel_options = WheelOption.all end # GET /wheel_options/1 or /wheel_options/1.json def show end # GET /wheel_options/new def new @wheel_option = WheelOption.new end # GET /wheel_options/1/edit def edit end # POST /wheel_options or /wheel_options.json def create @wheel_option = WheelOption.new(wheel_option_params) respond_to do |format| if @wheel_option.save format.html { redirect_to wheel_option_url(@wheel_option), notice: "Wheel option was successfully created." } format.json { render :show, status: :created, location: @wheel_option } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @wheel_option.errors, status: :unprocessable_entity } end end end # PATCH/PUT /wheel_options/1 or /wheel_options/1.json def update respond_to do |format| if @wheel_option.update(wheel_option_params) format.html { redirect_to wheel_option_url(@wheel_option), notice: "Wheel option was successfully updated." } format.json { render :show, status: :ok, location: @wheel_option } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @wheel_option.errors, status: :unprocessable_entity } end end end # DELETE /wheel_options/1 or /wheel_options/1.json def destroy @wheel_option.destroy respond_to do |format| format.html { redirect_to wheel_options_url, notice: "Wheel option was successfully destroyed." } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_wheel_option @wheel_option = WheelOption.find(params[:id]) end # Only allow a list of trusted parameters through. def wheel_option_params params.require(:wheel_option).permit(:wheel_id, :batch_id) end end