Sha256: 7eb2da240778c218833c4b8e124785ac7c971b1b26a5e55731fece4296f0ee36

Contents?: true

Size: 1.14 KB

Versions: 24

Compression:

Stored size: 1.14 KB

Contents

class AddressesController < ApplicationController
  before_action :set_address, only: [:show, :edit, :update, :destroy]

  # GET /addresses
  def index
    @addresses = Address.all
  end

  # GET /addresses/1
  def show
  end

  # GET /addresses/new
  def new
    @address = Address.new
  end

  # GET /addresses/1/edit
  def edit
  end

  # POST /addresses
  def create
    @address = Address.new(address_params)

    if @address.save
      redirect_to @address, notice: 'Address was successfully created.'
    else
      render :new
    end
  end

  # PATCH/PUT /addresses/1
  def update
    if @address.update(address_params)
      redirect_to @address, notice: 'Address was successfully updated.'
    else
      render :edit
    end
  end

  # DELETE /addresses/1
  def destroy
    @address.destroy
    redirect_to addresses_url, notice: 'Address was successfully destroyed.'
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_address
      @address = Address.find(params[:id])
    end

    # Only allow a list of trusted parameters through.
    def address_params
      params.fetch(:address, {})
    end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
eitil-1.3.3 spec/dummy_app/app/controllers/addresses_controller.rb
eitil-1.3.2 spec/dummy_app/app/controllers/addresses_controller.rb
eitil-1.3.1 spec/dummy_app/app/controllers/addresses_controller.rb
eitil-1.3.0 spec/dummy_app/app/controllers/addresses_controller.rb