Sha256: 75dbbe2cbf7875de65a25e345d7c867068852fed0597fd0f15818518bed2a8a9
Contents?: true
Size: 1.73 KB
Versions: 5
Compression:
Stored size: 1.73 KB
Contents
class TypesController < ApplicationController before_action :set_type, only: [:show, :edit, :update, :destroy] # GET /types # GET /types.json def index @types = Type.all end # GET /types/1 # GET /types/1.json def show end # GET /types/new def new @type = Type.new end # GET /types/1/edit def edit end # POST /types # POST /types.json def create @type = Type.new(type_params) respond_to do |format| if @type.save format.html { redirect_to @type, notice: 'Type was successfully created.' } format.json { render :show, status: :created, location: @type } else format.html { render :new } format.json { render json: @type.errors, status: :unprocessable_entity } end end end # PATCH/PUT /types/1 # PATCH/PUT /types/1.json def update respond_to do |format| if @type.update(type_params) format.html { redirect_to @type, notice: 'Type was successfully updated.' } format.json { render :show, status: :ok, location: @type } else format.html { render :edit } format.json { render json: @type.errors, status: :unprocessable_entity } end end end # DELETE /types/1 # DELETE /types/1.json def destroy @type.destroy respond_to do |format| format.html { redirect_to types_url, notice: 'Type was successfully destroyed.' } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_type @type = Type.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def type_params params.require(:type).permit(:code_id) end end
Version data entries
5 entries across 5 versions & 2 rubygems