Sha256: 2233b1c59c963cbfb308ad3db1420e2e1d10c36a8f700c2b9eea3d0a6584ed3f
Contents?: true
Size: 1.11 KB
Versions: 11
Compression:
Stored size: 1.11 KB
Contents
class ClientsController < ApplicationController before_action :set_client, only: [:show, :edit, :update, :destroy] # GET /clients def index @clients = Client.all end # GET /clients/1 def show end # GET /clients/new def new @client = Client.new end # GET /clients/1/edit def edit end # POST /clients def create @client = Client.new(client_params) if @client.save redirect_to @client, notice: 'Client was successfully created.' else render :new end end # PATCH/PUT /clients/1 def update if @client.update(client_params) redirect_to @client, notice: 'Client was successfully updated.' else render :edit end end # DELETE /clients/1 def destroy @client.destroy redirect_to clients_url, notice: 'Client was successfully destroyed.' end private # Use callbacks to share common setup or constraints between actions. def set_client @client = Client.find(params[:id]) end # Only allow a trusted parameter "white list" through. def client_params params[:client].permit(:name) end end
Version data entries
11 entries across 11 versions & 1 rubygems