Sha256: fdbe6be002c12cd6b29e3f34f43089cb56aaec535434cdda9d79546bc270908c
Contents?: true
Size: 1.6 KB
Versions: 6
Compression:
Stored size: 1.6 KB
Contents
require_dependency "customer_vault/application_controller" module CustomerVault class CorporationsController < ApplicationController before_action :set_corporation, only: [:show, :edit, :update, :destroy] # GET /corporations/1 def show end # GET /corporations/new def new @corporation = Corporation.new @corporation.build_address end # GET /corporations/1/edit def edit @corporation.build_address unless @corporation.address end # POST /corporations def create @corporation = Corporation.new(corporation_params) if @corporation.save redirect_to @corporation, notice: 'Corporation was successfully created.' else render action: 'new' end end # PATCH/PUT /corporations/1 def update if @corporation.update(corporation_params) redirect_to @corporation, notice: 'Corporation was successfully updated.' else render action: 'edit' end end # DELETE /corporations/1 def destroy @corporation.destroy redirect_to people_url, notice: 'Corporation was successfully destroyed.' end private # Use callbacks to share common setup or constraints between actions. def set_corporation @corporation = Corporation.find(params[:id]) end # Only allow a trusted parameter "white list" through. def corporation_params params.require(:corporation).permit(:name, :email, :phone, :fax, :address_attributes => [:street, :street_bis, :zip, :city, :country]) end end end
Version data entries
6 entries across 6 versions & 1 rubygems