cirandas.net

ref: master

app/helpers/maps_helper.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
module MapsHelper
  def self.search_city term, state=""
    cities = if state.empty?
      NationalRegion.search_city(term + "%", true)
    else
      NationalRegion.search_city(term + "%", true, state)
    end
    cities.map {|r|{ :label => r.city , :category => r.state}}
  end

  def self.search_state term
    NationalRegion.search_state(term + "%", true).map {|r|{ :label => r.state}}
  end
end