Class: Spree::Api::AddressesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/api/addresses_controller.rb

Instance Attribute Summary

Attributes inherited from BaseController

#current_api_user

Instance Method Summary collapse

Methods inherited from BaseController

#map_nested_attributes_keys, #set_jsonp_format

Methods included from ControllerSetup

included

Instance Method Details

#showObject



5
6
7
8
9
# File 'app/controllers/spree/api/addresses_controller.rb', line 5

def show
  @address = Address.find(params[:id])
  authorize! :read, @address
  respond_with(@address)
end

#updateObject



11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/spree/api/addresses_controller.rb', line 11

def update
  @address = Address.find(params[:id])
  authorize! :read, @address

  if @address.update_attributes(params[:address])
    respond_with(@address, :default_template => :show)
  else
    invalid_resource!(@address)
  end
end