Sha256: 94bded05bc59779f3424aa48d79f399609baf5ae2a734bdaece40fc54e14a2ab

Contents?: true

Size: 281 Bytes

Versions: 12

Compression:

Stored size: 281 Bytes

Contents

module EgovUtils
  class TownsController < ApplicationController
    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
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
egov_utils-1.5.0.alpha15 app/controllers/egov_utils/towns_controller.rb
egov_utils-1.5.0.alpha14 app/controllers/egov_utils/towns_controller.rb
egov_utils-1.5.0.alpha13 app/controllers/egov_utils/towns_controller.rb
egov_utils-1.5.0.alpha12 app/controllers/egov_utils/towns_controller.rb
egov_utils-1.5.0.alpha11 app/controllers/egov_utils/towns_controller.rb
egov_utils-1.5.0.alpha10 app/controllers/egov_utils/towns_controller.rb
egov_utils-1.5.0.alpha9 app/controllers/egov_utils/towns_controller.rb
egov_utils-1.5.0.alpha8 app/controllers/egov_utils/towns_controller.rb
egov_utils-1.5.0.alpha7 app/controllers/egov_utils/towns_controller.rb
egov_utils-1.5.0.alpha6 app/controllers/egov_utils/towns_controller.rb
egov_utils-1.5.0.alpha5 app/controllers/egov_utils/towns_controller.rb
egov_utils-1.5.0.alpha4 app/controllers/egov_utils/towns_controller.rb