Class: StatesController

Inherits:
Spree::BaseController show all
Defined in:
app/controllers/states_controller.rb

Instance Method Summary collapse

Methods included from SpreeBase

included

Methods inherited from ActionController::Base

#respond_with

Instance Method Details

#indexObject



5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/states_controller.rb', line 5

def index
  # table of {country.id => [ state.id , state.name ]}, arrays sorted by name
  # blank is added elsewhere, if needed
  # we return ALL known information, since billing country isn't restricted
  #   by shipping country
  @state_info = Hash.new {|h, k| h[k] = []}
  State.order("name ASC").each{|state|
    @state_info[state.country_id.to_s].push [state.id, state.name]
  }
end