小编Guy*_*rgo的帖子

使用rvm,postgres 9.0,ruby 1.9.2-p136在64位Snow Leopard上安装pg gem的问题

我想为Heroku构建一个Rails 3应用程序.他们使用Postgres作为他们的数据库,所以我通过MacPorts安装了postgres 9.0.现在我需要一个postgres gem,并且一致认为,出于性能原因,你需要pg gem.但是当我尝试通过rvm下的gem install安装pg时,我完全感到困惑.

我已经非常明确地指定了所有postgres目录的位置,但仍然无法完成安装:

$ env ARCHFLAGS='-arch x86_64' gem install pg -- \
   --with-pg-config=/opt/local/var/db/postgresql90/defaultdb/postgresql.conf \
   --with-pg-include=/opt/local/include/postgresql90/ \
   --with-pg-lib=/opt/local/lib/postgresql90/

Using config values from /opt/local/var/db/postgresql90/defaultdb/postgresql.conf
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/guy/.rvm/ruby-1.9.2-p136/bin/ruby
    --with-pg
    --without-pg
    --with-pg-dir
    --without-pg-dir
    --with-pg-include=${pg-dir}/include
    --with-pg-lib=${pg-dir}/lib
    --with-pg-config
extconf.rb:24:in ``': …
Run Code Online (Sandbox Code Playgroud)

ruby postgresql gem rvm pg

5
推荐指数
1
解决办法
3636
查看次数

使用Ruby on Rails在postgres中存储二进制对象

我需要在postgres DB中存储类似JSON的对象.最初我只是使用序列化字段,但它们占用了太多空间.所以我编写了一个简单的自定义压缩方案,现在使用Marshal.dump/load来访问数据.但是我用postgres的bytea字段类型遇到了障碍 - 它坚持要求每个不可见的字节编码为3位八进制数,例如'\ 377'.

http://www.postgresql.org/docs/8.1/static/datatype-binary.html

我看不到一个简单的方法来实现这一目标.s.pack("m#{s.size}")似乎生成单个'\'的字符串,而postgres想要'\'.最后添加一个gsub(/\/,'\\\\')似乎无法解决它.

有没有人有更优雅(和工作)的解决方案?

postgresql binary ruby-on-rails

5
推荐指数
1
解决办法
3580
查看次数

标签 统计

postgresql ×2

binary ×1

gem ×1

pg ×1

ruby ×1

ruby-on-rails ×1

rvm ×1