Sha256: 1b0391f24942d9da94063fdc7be279d911510de9026971358efa28b6a430dfa3
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true # :nocov: # Super basic controller for Things class ThingsController < ApplicationController before_action :set_thing, only: %i[show edit update destroy] # GET /things def index @things = Thing.all end # GET /things/1 def show; end # GET /things/new def new @thing = Thing.new end # GET /things/1/edit def edit; end # POST /things def create @thing = Thing.new(thing_params) if @thing.save redirect_to @thing, notice: 'Thing was successfully created.' else render :new end end # PATCH/PUT /things/1 def update if @thing.update(thing_params) redirect_to @thing, notice: 'Thing was successfully updated.' else render :edit end end # DELETE /things/1 def destroy @thing.destroy redirect_to things_url, notice: 'Thing was successfully destroyed.' end private # Use callbacks to share common setup or constraints between actions. def set_thing @thing = Thing.find(params[:id]) end # Only allow a list of trusted parameters through. def thing_params params.require(:thing).permit(:name, :description, works_cited_params) end end # :nocov:
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
works_cited-0.1.16 | spec/dummy/app/controllers/things_controller.rb |
works_cited-0.1.15 | spec/dummy/app/controllers/things_controller.rb |