2018-10-16 13:01:12 +02:00
|
|
|
class GeoArea < ApplicationRecord
|
|
|
|
belongs_to :champ
|
|
|
|
|
|
|
|
store :properties, accessors: [
|
|
|
|
:surface_intersection,
|
|
|
|
:surface_parcelle,
|
|
|
|
:numero,
|
|
|
|
:feuille,
|
|
|
|
:section,
|
|
|
|
:code_dep,
|
|
|
|
:nom_com,
|
|
|
|
:code_com,
|
|
|
|
:code_arr,
|
|
|
|
:code,
|
|
|
|
:nom,
|
2018-10-23 15:38:20 +02:00
|
|
|
:commune,
|
|
|
|
:culture,
|
|
|
|
:code_culture,
|
|
|
|
:surface,
|
|
|
|
:bio
|
2018-10-16 13:01:12 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
enum source: {
|
|
|
|
quartier_prioritaire: 'quartier_prioritaire',
|
2018-10-23 15:38:20 +02:00
|
|
|
cadastre: 'cadastre',
|
2018-10-31 13:29:25 +01:00
|
|
|
parcelle_agricole: 'parcelle_agricole',
|
|
|
|
selection_utilisateur: 'selection_utilisateur'
|
2018-10-16 13:01:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
scope :quartiers_prioritaires, -> { where(source: sources.fetch(:quartier_prioritaire)) }
|
|
|
|
scope :cadastres, -> { where(source: sources.fetch(:cadastre)) }
|
2018-10-23 15:38:20 +02:00
|
|
|
scope :parcelles_agricoles, -> { where(source: sources.fetch(:parcelle_agricole)) }
|
2018-10-16 13:01:12 +02:00
|
|
|
end
|