Class: Workarea::Api::Storefront::SavedAddressesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/workarea/api/storefront/saved_addresses_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#assert_current_metrics_id, #cache_page, #skip_session

Methods included from Authentication

#authentication?, #current_user, find_user

Instance Method Details

#createObject



13
14
15
16
# File 'app/controllers/workarea/api/storefront/saved_addresses_controller.rb', line 13

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

#destroyObject



25
26
27
28
# File 'app/controllers/workarea/api/storefront/saved_addresses_controller.rb', line 25

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

#indexObject



5
6
7
# File 'app/controllers/workarea/api/storefront/saved_addresses_controller.rb', line 5

def index
  @addresses = current_user.addresses
end

#showObject



9
10
11
# File 'app/controllers/workarea/api/storefront/saved_addresses_controller.rb', line 9

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

#updateObject



18
19
20
21
22
23
# File 'app/controllers/workarea/api/storefront/saved_addresses_controller.rb', line 18

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

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