Class: Workarea::Api::Storefront::SavedAddressesController
Instance Method Summary
collapse
#assert_current_metrics_id, #cache_page, #skip_session
#authentication?, #current_user, find_user
Instance Method Details
#create ⇒ Object
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
|
#destroy ⇒ Object
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
|
#index ⇒ Object
5
6
7
|
# File 'app/controllers/workarea/api/storefront/saved_addresses_controller.rb', line 5
def index
@addresses = current_user.addresses
end
|
#show ⇒ Object
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
|
#update ⇒ Object
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
|