Sha256: e128666602478d0892a264ce195bd96bf90935498a11d49f89749f453148aafa

Contents?: true

Size: 464 Bytes

Versions: 2

Compression:

Stored size: 464 Bytes

Contents

require_dependency "addresses/application_controller"

module Addresses
  class CitiesController < ApplicationController
    def index
      if State.exists?(params[:state_id])
        @state = State.find(params[:state_id])
        @cities = @state.cities.order("name asc")
      else
        @cities = City.filter(params)
      end

      render json: @cities
    end

    def show
      @city = City.find(params[:id])

      render json: @city
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
addresses-1.0.9 app/controllers/addresses/cities_controller.rb
addresses-1.0.8 app/controllers/addresses/cities_controller.rb