71 lines
1.9 KiB
Ruby
71 lines
1.9 KiB
Ruby
|
|
class CardRxesController < ApplicationController
|
||
|
|
before_action :set_card_rx, only: %i[ show edit update destroy ]
|
||
|
|
|
||
|
|
# GET /card_rxes or /card_rxes.json
|
||
|
|
def index
|
||
|
|
@card_rxes = CardRx.all
|
||
|
|
end
|
||
|
|
|
||
|
|
# GET /card_rxes/1 or /card_rxes/1.json
|
||
|
|
def show
|
||
|
|
end
|
||
|
|
|
||
|
|
# GET /card_rxes/new
|
||
|
|
def new
|
||
|
|
@card_rx = CardRx.new
|
||
|
|
end
|
||
|
|
|
||
|
|
# GET /card_rxes/1/edit
|
||
|
|
def edit
|
||
|
|
end
|
||
|
|
|
||
|
|
# POST /card_rxes or /card_rxes.json
|
||
|
|
def create
|
||
|
|
@card_rx = CardRx.new(card_rx_params)
|
||
|
|
|
||
|
|
respond_to do |format|
|
||
|
|
if @card_rx.save
|
||
|
|
format.html { redirect_to @card_rx, notice: "Card rx was successfully created." }
|
||
|
|
format.json { render :show, status: :created, location: @card_rx }
|
||
|
|
else
|
||
|
|
format.html { render :new, status: :unprocessable_entity }
|
||
|
|
format.json { render json: @card_rx.errors, status: :unprocessable_entity }
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
# PATCH/PUT /card_rxes/1 or /card_rxes/1.json
|
||
|
|
def update
|
||
|
|
respond_to do |format|
|
||
|
|
if @card_rx.update(card_rx_params)
|
||
|
|
format.html { redirect_to @card_rx, notice: "Card rx was successfully updated.", status: :see_other }
|
||
|
|
format.json { render :show, status: :ok, location: @card_rx }
|
||
|
|
else
|
||
|
|
format.html { render :edit, status: :unprocessable_entity }
|
||
|
|
format.json { render json: @card_rx.errors, status: :unprocessable_entity }
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
# DELETE /card_rxes/1 or /card_rxes/1.json
|
||
|
|
def destroy
|
||
|
|
@card_rx.destroy!
|
||
|
|
|
||
|
|
respond_to do |format|
|
||
|
|
format.html { redirect_to card_rxes_path, notice: "Card rx was successfully destroyed.", status: :see_other }
|
||
|
|
format.json { head :no_content }
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
private
|
||
|
|
# Use callbacks to share common setup or constraints between actions.
|
||
|
|
def set_card_rx
|
||
|
|
@card_rx = CardRx.find(params[:id])
|
||
|
|
end
|
||
|
|
|
||
|
|
# Only allow a list of trusted parameters through.
|
||
|
|
def card_rx_params
|
||
|
|
params.require(:card_rx).permit(:help_desk, :customer_service, :web_url)
|
||
|
|
end
|
||
|
|
end
|