Module: SpatialFeatures::FeaturesAssociationExtensions

Defined in:
lib/spatial_features/has_spatial_features.rb

Instance Method Summary collapse

Instance Method Details

#area(options = {}) ⇒ Object



249
250
251
252
253
254
255
# File 'lib/spatial_features/has_spatial_features.rb', line 249

def area(options = {})
  if options[:cache] == false || !proxy_association.owner.class.has_features_area?
    pluck('ST_Area(ST_UNION(geom))').first.to_f
  else
    proxy_association.owner.features_area.to_f
  end
end