Module: ActiveRecordSpatial::Associations::ClassMethods
- Defined in:
- lib/activerecord-spatial/associations.rb,
lib/activerecord-spatial/associations/base.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#has_many_spatially(name, scope = nil, **options, &extension) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/activerecord-spatial/associations.rb', line 10 def has_many_spatially(name, scope = nil, **, &extension) = () unless ActiveRecordSpatial::SpatialScopeConstants::RELATIONSHIPS.include?([:relationship].to_s) raise ArgumentError, %{Invalid spatial relationship "#{[:relationship]}", expected one of #{ActiveRecordSpatial::SpatialScopeConstants::RELATIONSHIPS.inspect}} end reflection = ActiveRecord::Associations::Builder::Spatial.build(self, name, scope, , &extension) ActiveRecord::Reflection.add_reflection(self, name, reflection) end |