Do not crash on boot if geos is not installed

This commit is contained in:
Paul Chavard 2020-04-23 16:16:22 +02:00
parent 04cf174039
commit 2a3530738d
3 changed files with 2 additions and 6 deletions

View file

@ -25,7 +25,6 @@ gem 'devise' # Gestion des comptes utilisateurs
gem 'devise-async'
gem 'discard'
gem 'dotenv-rails', require: 'dotenv/rails-now' # dotenv should always be loaded before rails
gem 'ffi-geos'
gem 'flipper'
gem 'flipper-active_record'
gem 'flipper-ui'

View file

@ -215,8 +215,6 @@ GEM
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
ffi (1.12.2)
ffi-geos (2.1.0)
ffi (>= 1.0.0)
flipper (0.17.2)
flipper-active_record (0.17.2)
activerecord (>= 4.2, < 7)
@ -753,7 +751,6 @@ DEPENDENCIES
discard
dotenv-rails
factory_bot
ffi-geos
flipper
flipper-active_record
flipper-ui

View file

@ -55,13 +55,13 @@ class GeoArea < ApplicationRecord
end
def area
if polygon?
if polygon? && RGeo::Geos.supported?
rgeo_geometry.area.round(1)
end
end
def length
if line?
if line? && RGeo::Geos.supported?
rgeo_geometry.length.round(1)
end
end