Class: EgovUtils::TownsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- EgovUtils::TownsController
- Defined in:
- app/controllers/egov_utils/towns_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/controllers/egov_utils/towns_controller.rb', line 3 def index selected = EgovUtils::Address.towns.lazy.select do |town| /\A#{params[:term]}/i.match?(town.name) end.first(10) render json: { towns: selected.map(&:to_h) } end |