Sha256: 66a525dc0f5289c27e2b4124ee4727112cdd02254caf7032e0ee772e70bf7f64

Contents?: true

Size: 575 Bytes

Versions: 6

Compression:

Stored size: 575 Bytes

Contents

class StatesController < Spree::BaseController
  resource_controller

  ssl_allowed :index
  
  index.response do |wants|
    wants.html
    wants.js do
      # 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 = {};
      Country.all.each do |c|
        next if c.states.empty?
        @state_info[c.id] = c.states.sort.collect {|s| [s.id, s.name] }
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spree-0.8.4 app/controllers/states_controller.rb
spree-0.8.5 app/controllers/states_controller.rb
spree-0.8.0 app/controllers/states_controller.rb
spree-0.8.1 app/controllers/states_controller.rb
spree-0.8.2 app/controllers/states_controller.rb
spree-0.8.3 app/controllers/states_controller.rb