Sha256: 45c97403630799eed3def779d77bdb1f2d6fbf2a8e90edbc03a772e53ad8fd44

Contents?: true

Size: 648 Bytes

Versions: 1

Compression:

Stored size: 648 Bytes

Contents

require_dependency "shopping_cart/application_controller"

module ShoppingCart
  class AddressesController < ApplicationController
    before_action :authenticate_user!

    def update
      SettingsAddresser.call(address_params) do
        on(:ok) { redirect_to address_path, notice: I18n.t('notice.updated') }
        on(:invalid) do |address|
          expose(address: address)
          render :edit
        end
      end
    end

    private

    def address_params
      params.require(:address).permit(:first_name, :last_name, :address, :city, :zip,
                                      :country, :phone, :type, :user_id)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
loker-shopping-cart-0.1.3 app/controllers/shopping_cart/addresses_controller.rb