Sha256: a172b526c5a04c383e550ef2dbe06b588a18d5d5fa8c8ed75bc1909d9f5d5281

Contents?: true

Size: 905 Bytes

Versions: 7

Compression:

Stored size: 905 Bytes

Contents

# frozen_string_literal: true

class CoreBasedStatisticalAreasController < ApplicationController
  before_action :set_breadcrumbs

  def index
    cbsas = if @combined_statistical_area
      @combined_statistical_area.core_based_statistical_areas.order(:name)
    else
      USGeo::CoreBasedStatisticalArea.not_removed.order(:name)
    end

    @tab = params[:tab]
    if @tab.present?
      type = if @tab == "metropolitan"
        "MetropolitanArea"
      elsif @tab == "micropolitan"
        "MicropolitanArea"
      end
      cbsas = cbsas.where(type: type)
    end

    @core_based_statistical_areas = cbsas.order(:name)
  end

  def show
    @core_based_statistical_area = USGeo::CoreBasedStatisticalArea.find(params[:id])
    add_breadcrumb(core_based_statistical_area_id: @core_based_statistical_area)
  end

  private

  def set_breadcrumbs
    add_combined_statistical_area_breadcrumb
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
us_geo-2.1.1 explorer_app/app/controllers/core_based_statistical_areas_controller.rb
us_geo-2.1.0 explorer_app/app/controllers/core_based_statistical_areas_controller.rb
us_geo-2.0.4 explorer_app/app/controllers/core_based_statistical_areas_controller.rb
us_geo-2.0.3 explorer_app/app/controllers/core_based_statistical_areas_controller.rb
us_geo-2.0.2 explorer_app/app/controllers/core_based_statistical_areas_controller.rb
us_geo-2.0.1 explorer_app/app/controllers/core_based_statistical_areas_controller.rb
us_geo-2.0.0 explorer_app/app/controllers/core_based_statistical_areas_controller.rb