Class: AddressesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/addresses_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#get_login_link, #set_locale_with_config

Instance Method Details

#newObject



14
15
16
17
18
19
# File 'app/controllers/addresses_controller.rb', line 14

def new
  @address = UserAddress.new(params[:address])
  render(:update) do |page|
    page.replace_html '#delivery_address .account-form', :partial => 'address_form', :locals => {:address => @address}
  end
end

#showObject



7
8
9
10
11
12
# File 'app/controllers/addresses_controller.rb', line 7

def show
  respond_to do |format|
    format.html { page_not_found }
    format.json { render :json => @address.to_json }
  end
end

#updateObject



21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/addresses_controller.rb', line 21

def update
  if @address.update_attributes(params[:address])
    flash[:notice] = I18n.t('address_update_ok').capitalize
  else
    flash[:error] = "Une erreur est survenue lors de la mise à jour de l'addresse"
  end
  render(:update) do |page|
    page.replace_html '#delivery_address .account-form', :partial => 'address_form', :locals => {:address => @address}
  end
end