Module: SpatialFeatures::FeaturesAssociationExtensions

Defined in:
lib/spatial_features/has_spatial_features.rb

Instance Method Summary collapse

Instance Method Details

#area(options = {}) ⇒ Object



234
235
236
237
238
239
240
# File 'lib/spatial_features/has_spatial_features.rb', line 234

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