Module: RGeo::ActiveRecord::GeoConnectionAdapters
- Defined in:
- lib/rgeo/active_record/common_adapter_elements.rb
Overview
Provide methods for each geometric subtype during table changes.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
71 72 73 74 75 76 |
# File 'lib/rgeo/active_record/common_adapter_elements.rb', line 71 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
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/rgeo/active_record/common_adapter_elements.rb', line 78 def method_missing_with_rgeo(method_name, *args, &block) if @base.respond_to?(:spatial_column_construcor) && (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| @base.add_column(@table_name, name, type, opts) end else method_missing_without_rgeo(method_name, *args, &block) end end |