app/controllers/application_controller.rb
# return whatever facility is indicated by the :facility_id or :id url parameter
# UNLESS that url parameter has the value of 'all'
# in which case, return the all facility
return whatever facility is indicated by the :facility_id or :id url parameter
UNLESS that url parameter has the value of 'all'
in which case, return the all facility
return whatever facility is indicated by the : facility_id or : id url parameter UNLESS that url parameter has the value of ' all ' in which case return the all facility
def current_facility
    facility_id = params[:facility_id] || params[:id]
    @current_facility ||=
      case
      when facility_id.blank?
        nil 
      when facility_id == Facility.cross_facility.url_name
        Facility.cross_facility
      else
        Facility.find_by(url_name: facility_id)
      end
  end
def current_facility facility_id = params [ :facility_id ] || params [ :id ] @current_facility ||= case when facility_id . blank? nil when facility_id == Facility . cross_facility . url_name Facility . cross_facility else Facility . find_by ( url_name : facility_id ) end end
return whatever facility is indicated by the :facility_id or :id url parameter
UNLESS that url parameter has the value of 'all'
in which case, return the all facility
return whatever facility is indicated by the : facility_id or : id url parameter UNLESS that url parameter has the value of ' all ' in which case return the all facility
# TODO: consider a refactoring to use a null object