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
|
||||
ActiveRecord::Coders::YAMLColumn.new(:properties).load(value)
|
||||
else
|
||||
value
|
||||
value || {}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue