Sha256: 17eb1328cdfe108aed61576de7d67f726b0a1dcc00158c1154c51ca5ef875ae2

Contents?: true

Size: 501 Bytes

Versions: 2

Compression:

Stored size: 501 Bytes

Contents

# frozen_string_literal: true

require 'active_support/concern'

module ActiveRecordMysqlSpatial
  module ActsAsSpatial
    extend ActiveSupport::Concern

    class_methods do
      def acts_as_linestring(*columns, serializer: nil)
        return if serializer.blank?

        columns.each do |col|
          attribute(col, serializer.new)
        end
      end

      alias_method :acts_as_point, :acts_as_linestring
      alias_method :acts_as_multilinestring, :acts_as_linestring
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_record_mysql_spatial-0.3.0 lib/active_record_mysql_spatial/acts_as_spatial.rb
active_record_mysql_spatial-0.2.0 lib/active_record_mysql_spatial/acts_as_spatial.rb