Merge pull request #6232 from tchak/fix-carto
Do not crash when properties is nil
This commit is contained in:
commit
6fbf689f20
2 changed files with 9 additions and 1 deletions
|
@ -22,7 +22,7 @@ class GeoArea < ApplicationRecord
|
||||||
if value.is_a? String
|
if value.is_a? String
|
||||||
ActiveRecord::Coders::YAMLColumn.new(:properties).load(value)
|
ActiveRecord::Coders::YAMLColumn.new(:properties).load(value)
|
||||||
else
|
else
|
||||||
value
|
value || {}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -100,4 +100,12 @@ RSpec.describe GeoArea, type: :model do
|
||||||
end
|
end
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue