Module: GeographicAreaTypesHelper

Defined in:
app/helpers/geographic_area_types_helper.rb

Instance Method Summary collapse

Instance Method Details



8
9
10
11
# File 'app/helpers/geographic_area_types_helper.rb', line 8

def geographic_area_type_link(geographic_area_type)
  return nil if geographic_area_type.nil?
  link_to(geographic_area_type.name, geographic_area_type)
end

#geographic_area_type_name_select_options(selected) ⇒ Object



13
14
15
16
17
18
19
# File 'app/helpers/geographic_area_types_helper.rb', line 13

def geographic_area_type_name_select_options(selected)
  # You could just render this as is, instead of wrapping it in a helper:
  options_from_collection_for_select(GeographicAreaType.all.order(:name),
                                     :id,
                                     :name,
                                     (selected.nil? ? GeographicAreaType.where(name: 'Unknown').first.id : selected))
end

#geographic_area_type_tag(geographic_area_type) ⇒ Object



3
4
5
6
# File 'app/helpers/geographic_area_types_helper.rb', line 3

def geographic_area_type_tag(geographic_area_type)
  return nil if geographic_area_type.nil?
  geographic_area_type.name
end