Sha256: b4821dc7d4e6f8767a7c5212ac08d15ee5c627fbd1be3d935083f8250a85fab1

Contents?: true

Size: 669 Bytes

Versions: 2

Compression:

Stored size: 669 Bytes

Contents

class StatesController < Spree::BaseController
  resource_controller

  ssl_allowed :index
  
  index.response do |wants|
    wants.html
    wants.js do
      # @states = end_of_association_chain.find(:all, :conditions => ['lower(name) LIKE ?', "%#{params[:q].downcase}%"], :order => :name)
     
      # table of {country.id => { state.id => state.name }}
      # blank added elsewhere, if needed
      usa = {}
      State.find(:all, :conditions => "country_id = 214", 
                       :select => "id, name"
                       ).each do |s|
        usa[s.name] = s.id
      end
      @state_info = { "214" => usa }	# to be generalised...
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree-0.7.1 app/controllers/states_controller.rb
spree-0.7.0 app/controllers/states_controller.rb