Module: ActiveRecord::ConnectionAdapters::PostGISAdapter::DecorateColumnsModification
- Defined in:
- lib/active_record/connection_adapters/postgis_adapter/rails4/spatial_column.rb
Overview
This is a hack to ActiveRecord::ModelSchema. We have to “decorate” the decorate_columns method to apply class-specific customizations to spatial type casting.
Instance Method Summary collapse
Instance Method Details
#decorate_columns(columns_hash_) ⇒ Object
:nodoc:
162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/active_record/connection_adapters/postgis_adapter/rails4/spatial_column.rb', line 162 def decorate_columns(columns_hash_) columns_hash_ = super(columns_hash_) return unless columns_hash_ canonical_columns_ = self.columns_hash columns_hash_.each do |name_, col_| if col_.is_a?(SpatialOID) && (canonical_ = canonical_columns_[name_]) && canonical_.spatial? columns_hash_[name_] = canonical_ end end columns_hash_ end |