Module: RGeo::ActiveRecord::GeoTableDefinitions
- Defined in:
- lib/rgeo/active_record/common_adapter_elements.rb
Overview
Provide methods for each geometric subtype during table definitions.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/rgeo/active_record/common_adapter_elements.rb', line 45 def self.included(base) base.class_eval do alias_method :method_missing_without_rgeo, :method_missing alias_method :method_missing, :method_missing_with_rgeo end end |
Instance Method Details
#method_missing_with_rgeo(method_name, *args, &block) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rgeo/active_record/common_adapter_elements.rb', line 52 def method_missing_with_rgeo(method_name, *args, &block) if @base.respond_to?(:spatial_column_constructor) && (info = @base.spatial_column_constructor(method_name)) info = info.dup type = (info.delete(:type) || method_name).to_s opts = args..merge(info) args.each do |name| column(name, type, opts) end else method_missing_without_rgeo(method_name, *args, &block) end end |