Sha256: 5efe9d42889332111d8282fd28b37ba1027e700e64190bf5eb58a03c67aeec08
Contents?: true
Size: 863 Bytes
Versions: 4
Compression:
Stored size: 863 Bytes
Contents
# # # PostGIS Adapter # # # http://github.com/nofxx/postgis_adapter # module PostgisFunctions def self.included(base) base.send :extend, ClassMethods end module ClassMethods # acts_as_geom :geom def acts_as_geom(*columns) cattr_accessor :postgis_geoms geoms = columns.map do |g| geom_type = get_geom_type(g) case geom_type when :point send :include, PointFunctions when :polygon send :include, PolygonFunctions when :line_string send :include, LineStringFunctions end {g => geom_type} end self.postgis_geoms = {:geoms => geoms}#, :opts => options} end def get_geom_type(column) self.columns.select { |c| c.name == column.to_s}.first.geometry_type end end end ActiveRecord::Base.send :include, PostgisFunctions
Version data entries
4 entries across 4 versions & 2 rubygems