Class: Spree::Billing::AddressesController

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

Instance Method Summary collapse

Methods inherited from BaseController

#current_vendor, #default_url_options, #edit_object_url, #handle_unauthorized_vendor, #page, #per_page, #required_vendor_user!, #set_locale, #switch_vendor, #vendors

Methods included from SpreeCmCommissioner::Billing::RoleAuthorization

#auth_action, #auth_entry, #auth_user, #authorize!, #authorize?, #authorize_admin, #authorize_role!, #redirect_unauthorized_access

Instance Method Details

#collection_url(options = {}) ⇒ Object



27
28
29
# File 'app/controllers/spree/billing/addresses_controller.rb', line 27

def collection_url(options = {})
  billing_customer_addresses_url(options)
end

#customerObject



19
20
21
# File 'app/controllers/spree/billing/addresses_controller.rb', line 19

def customer
  @customer ||= SpreeCmCommissioner::Customer.find(params[:customer_id])
end

#load_addressesObject



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

def load_addresses
  @ship_address = customer.ship_address || customer.build_ship_address
  @bill_address = customer.bill_address || customer.build_bill_address

  @ship_address.country ||= current_store.default_country
  @bill_address.country ||= current_store.default_country
end

#load_customerObject



15
16
17
# File 'app/controllers/spree/billing/addresses_controller.rb', line 15

def load_customer
  customer
end

#model_classObject



23
24
25
# File 'app/controllers/spree/billing/addresses_controller.rb', line 23

def model_class
  Spree::Address
end