Class: Stay::Admin::AddressesController

Inherits:
BaseController show all
Defined in:
app/controllers/stay/admin/addresses_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#load_stores, #set_currency, #set_current_store, #stores_scope

Methods included from ControllerHelpers::Store

#current_store, #ensure_current_store, #store_locale

Methods included from ControllerHelpers::Currency

#currency_param, #current_currency, #supported_currencies, #supported_currencies_for_all_stores, #supported_currency?

Methods inherited from Stay::ApplicationController

#after_sign_in_path_for, #current_store

Methods included from LocaleHelper

#all_locales_options, #available_locales, #available_locales_options, #config_locale?, #current_locale, #find_with_fallback_default_locale, #locale_full_name, #locale_param, #locale_presentation, #params_locale?, #should_render_locale_dropdown?, #supported_locale?, #supported_locales, #supported_locales_for_all_stores, #supported_locales_options, #user_locale?

Methods included from CurrencyHelper

#currency_options, #currency_presentation, #currency_symbol, #should_render_currency_dropdown?, #supported_currency_options

Instance Method Details

#createObject

POST /Stay/admin/addresses POST /Stay/admin/addresses.json



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/stay/admin/addresses_controller.rb', line 28

def create
  @address = Stay::Address.new(address_params)

  respond_to do |format|
    if @address.save
      format.html { redirect_to [:admin, @address], notice: 'Address was successfully created.' }
      format.json { render :show, status: :created, location: @address }
    else
      format.html { render :new }
      format.json { render json: @address.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /Stay/admin/addresses/1 DELETE /Stay/admin/addresses/1.json



58
59
60
61
62
63
64
# File 'app/controllers/stay/admin/addresses_controller.rb', line 58

def destroy
  @address.destroy
  respond_to do |format|
    format.html { redirect_to admin_addresses_url, notice: 'Address was successfully destroyed.' }
    format.json { head :no_content }
  end
end

#editObject

GET /Stay/admin/addresses/1/edit



23
24
# File 'app/controllers/stay/admin/addresses_controller.rb', line 23

def edit
end

#indexObject

GET /Stay/admin/addresses GET /Stay/admin/addresses.json



8
9
10
# File 'app/controllers/stay/admin/addresses_controller.rb', line 8

def index
  @addresses = Stay::Address.page(params[:page])
end

#newObject

GET /Stay/admin/addresses/new



18
19
20
# File 'app/controllers/stay/admin/addresses_controller.rb', line 18

def new
  @address = Stay::Address.new
end

#showObject

GET /Stay/admin/addresses/1 GET /Stay/admin/addresses/1.json



14
15
# File 'app/controllers/stay/admin/addresses_controller.rb', line 14

def show
end

#updateObject

PATCH/PUT /Stay/admin/addresses/1 PATCH/PUT /Stay/admin/addresses/1.json



44
45
46
47
48
49
50
51
52
53
54
# File 'app/controllers/stay/admin/addresses_controller.rb', line 44

def update
  respond_to do |format|
    if @address.update(address_params)
      format.html { redirect_to [:admin, @address], notice: 'Address was successfully updated.' }
      format.json { render :show, status: :ok, location: @address }
    else
      format.html { render :edit }
      format.json { render json: @address.errors, status: :unprocessable_entity }
    end
  end
end