Sha256: 1ead9e8946e72342449daccf7132151e6b21f2f8c34818bf6b30a7634ede70be

Contents?: true

Size: 603 Bytes

Versions: 1

Compression:

Stored size: 603 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.find(:all, :include => :states).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

1 entries across 1 versions & 1 rubygems

Version Path
kdmny-spree-0.0.1 app/controllers/states_controller.rb