Browse Source

renums

pull/669/head
JG 3 years ago
parent
commit
3921738f78
  1. 14
      app/models/location.rb

14
app/models/location.rb

@ -1,22 +1,20 @@
class Location < ApplicationRecord class Location < ApplicationRecord
belongs_to :scheme belongs_to :scheme
WHEELCHAIR_ADAPTATION = { WHEELCHAIR_ADAPTATIONS = {
0 => "No", no: 0,
1 => "Yes", yes: 1,
}.freeze }.freeze
enum wheelchair_adaptation: WHEELCHAIR_ADAPTATIONS
def display_attributes def display_attributes
[ [
{ name: "Location code ", value: location_code, suffix: false }, { name: "Location code ", value: location_code, suffix: false },
{ name: "Postcode", value: postcode, suffix: county }, { name: "Postcode", value: postcode, suffix: county },
{ name: "Type of unit", value: type_of_unit, suffix: false }, { name: "Type of unit", value: type_of_unit, suffix: false },
{ name: "Type of building", value: type_of_building, suffix: false }, { name: "Type of building", value: type_of_building, suffix: false },
{ name: "Wheelchair adaptation", value: wheelchair_adaptation_display, suffix: false }, { name: "Wheelchair adaptation", value: wheelchair_adaptation, suffix: false },
] ]
end end
def wheelchair_adaptation_display
WHEELCHAIR_ADAPTATION[wheelchair_adaptation]
end
end end

Loading…
Cancel
Save