无法识别“位置”的类型。它将被视为字符串 [英] Failed to recognize type of 'location'. It will be treated as String

查看:97
本文介绍了无法识别“位置”的类型。它将被视为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用gem activerecord-postgis-adapter ,当我尝试执行此代码时:

I'm trying to use the gem activerecord-postgis-adapter and when i try to execute this code :

require 'active-record' 
require 'pg'
require 'active record-postgis-adapter'

class Place < ActiveRecord::Base
   record = Place.find(1)
   line = record.location
   puts line.srid
end

srid activerecord-postgis-adapter 的方法, '试图显示我的地理列(位置)的 srid ,但控制台不断告诉我无法识别'位置'类型。它将被视为字符串。

srid is a method of activerecord-postgis-adapter and here i'm trying to display the srid of my geographical column (location) but the console keeps telling me Failed to recognize type of 'location'. It will be treated as String..

推荐答案

可能找到解决方案来解决我的问题,当连接到 postgresql 数据库,我改为 postgis ,现在它可以工作。

Probably found a solution to my problem, i used postgresql as the adapter when connecting to the database, i changed to postgis and now it works.

这篇关于无法识别“位置”的类型。它将被视为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆