diff --git a/app/models/geo_area.rb b/app/models/geo_area.rb index b8dcd31fe..ff57fbb9c 100644 --- a/app/models/geo_area.rb +++ b/app/models/geo_area.rb @@ -22,7 +22,7 @@ class GeoArea < ApplicationRecord if value.is_a? String ActiveRecord::Coders::YAMLColumn.new(:properties).load(value) else - value + value || {} end end diff --git a/spec/models/geo_area_spec.rb b/spec/models/geo_area_spec.rb index ac3e1aab2..dfb5aa10e 100644 --- a/spec/models/geo_area_spec.rb +++ b/spec/models/geo_area_spec.rb @@ -100,4 +100,12 @@ RSpec.describe GeoArea, type: :model do end end end + + describe 'description' do + context 'when properties is nil' do + let(:geo_area) { build(:geo_area, properties: nil) } + + it { expect(geo_area.description).to be_nil } + end + end end