3
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/spatial_features/has_spatial_features.rb', line 3
def has_spatial_features(options = {})
has_many :features, :as => :spatial_model, :dependent => :delete_all
scope :with_features, lambda { where(:id => Feature.select(:spatial_model_id).where(:spatial_model_type => name)) }
scope :without_features, lambda { where.not(:id => Feature.select(:spatial_model_id).where(:spatial_model_type => name)) }
has_many :spatial_cache, :as => :spatial_model, :dependent => :delete_all
has_many :model_a_spatial_proximities, :as => :model_a, :class_name => 'SpatialProximity', :dependent => :delete_all
has_many :model_b_spatial_proximities, :as => :model_b, :class_name => 'SpatialProximity', :dependent => :delete_all
extend SpatialFeatures::ClassMethods
include SpatialFeatures::InstanceMethods
end
|