Sha256: fcb286a9fe15a3a84fa66b162611c36b1bc28bde584eead2b91fad473bf73f51

Contents?: true

Size: 857 Bytes

Versions: 16

Compression:

Stored size: 857 Bytes

Contents

module Workarea
  module Api
    module Storefront
      class SavedAddressesController < Api::Storefront::ApplicationController
        def index
          @addresses = current_user.addresses
        end

        def show
          @address = current_user.addresses.find(params[:id])
        end

        def create
          @address = current_user.addresses.create!(address_params)
          render :show
        end

        def update
          @address = current_user.addresses.find(params[:id])

          @address.update_attributes!(address_params)
          render :show
        end

        def destroy
          current_user.addresses.find(params[:id]).destroy
          head :no_content
        end

        private

        def address_params
          params.permit(*Workarea.config.address_attributes)
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
workarea-api-4.5.6 storefront/app/controllers/workarea/api/storefront/saved_addresses_controller.rb
workarea-api-storefront-4.5.6 app/controllers/workarea/api/storefront/saved_addresses_controller.rb
workarea-api-4.5.5 storefront/app/controllers/workarea/api/storefront/saved_addresses_controller.rb
workarea-api-storefront-4.5.5 app/controllers/workarea/api/storefront/saved_addresses_controller.rb
workarea-api-4.5.4 storefront/app/controllers/workarea/api/storefront/saved_addresses_controller.rb
workarea-api-storefront-4.5.4 app/controllers/workarea/api/storefront/saved_addresses_controller.rb
workarea-api-4.5.3 storefront/app/controllers/workarea/api/storefront/saved_addresses_controller.rb
workarea-api-storefront-4.5.3 app/controllers/workarea/api/storefront/saved_addresses_controller.rb
workarea-api-4.5.2 storefront/app/controllers/workarea/api/storefront/saved_addresses_controller.rb
workarea-api-storefront-4.5.2 app/controllers/workarea/api/storefront/saved_addresses_controller.rb
workarea-api-4.5.0 storefront/app/controllers/workarea/api/storefront/saved_addresses_controller.rb
workarea-api-storefront-4.5.0 app/controllers/workarea/api/storefront/saved_addresses_controller.rb
workarea-api-4.4.7 storefront/app/controllers/workarea/api/storefront/saved_addresses_controller.rb
workarea-api-storefront-4.4.7 app/controllers/workarea/api/storefront/saved_addresses_controller.rb
workarea-api-4.4.6 storefront/app/controllers/workarea/api/storefront/saved_addresses_controller.rb
workarea-api-storefront-4.4.6 app/controllers/workarea/api/storefront/saved_addresses_controller.rb