Sha256: 6d856f26280eb5296a6d9b57a37c45d5a31387db8684df4c340da11d5302e68a
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
class CompaniesController < ApplicationController before_action :set_company, only: [:show, :edit, :update, :destroy] # GET /companies def index @companies = Company.all end # GET /companies/1 def show end # GET /companies/new def new @company = Company.new end # GET /companies/1/edit def edit end # POST /companies def create @company = Company.new(company_params) if @company.save redirect_to @company, notice: 'Company was successfully created.' else render :new end end # PATCH/PUT /companies/1 def update if @company.update(company_params) redirect_to @company, notice: 'Company was successfully updated.' else render :edit end end # DELETE /companies/1 def destroy @company.destroy redirect_to companies_url, notice: 'Company was successfully destroyed.' end private # Use callbacks to share common setup or constraints between actions. def set_company @company = Company.find(params[:id]) end # Only allow a trusted parameter "white list" through. def company_params params.require(:company).permit(:name) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
susply-1.0.0 | spec/dummy/app/controllers/companies_controller.rb |
susply-0.0.2 | spec/dummy/app/controllers/companies_controller.rb |