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