class API::V1::CountriesController < API::APIController

  def index
    @countries = Portal::Country.all.map{ |c| {name: c.name, id: c.id} }
    render :json => @countries
  end

end

class API::V1::CountriesController < API::APIController

  def index
    @countries = Portal::Country.all.sort_by{ |k| k["name"]}.map{ |c| {name: c.name, id: c.id} }
    render :json => @countries
  end

end

Sort countries by name before output in API
Sort countries by name before output in API

