为什么我不能安装postgreSQL与rails 4.0.0.rc1(ruby 2.0) [英] Why I can't install postgresql with rails 4.0.0.rc1 (ruby 2.0)

查看:158
本文介绍了为什么我不能安装postgreSQL与rails 4.0.0.rc1(ruby 2.0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一次在论坛上,所以我会尽量具体一样可以,对不起任何可能的错字确定吗?



我比较新的rails比一年),我想制作一个默认项目使用它。我一直使用sqlite3在开发和pg在生产(heroku),但现在我想做正确的事情(我遇到的问题,sqlite3运行确定,但pg不)和使用pg在生产和devlop。



我花了2天搜索foruns,所有的anwser是旧的或其他版本/其他操作系统。



列出我设置我的舞台的步骤:
这里我的配置:



-OS:Windows 7 64x

-Editor :Aptana Studio

-PostGresql

-Rails 4.0.0.rc1

-Ruby 2.0


  1. 下载并安装postgresql-9.2.4-1-windows-x64

  2. 为postgresql设置默认密码

  3. 在postgresql中使用所有权限创建角色my_user

  4. 创建测试数据库rails_test

  5. 打开Aptana Studio,默认项目进入项目文件夹,而不是运行rails new。-d postgresql来生成新项目。

  6. 安装pg gemgem install pggem list正确地

     <$> 

    配置database.yml以使用正确的用户名和密码

    c $ c>开发:
    适配器:postgresql
    编码:unicode
    数据库:rails_test
    池:5
    用户名:my_user
    密码:12345


  7. 在ruby中运行一些命令,如gem update,bundle install

    / li>

然后当我尝试生成一个模型并使用rake db:migrate我得到以下错误:

 为数据库适配器指定了postgresql,但未加载gem。添加`gem'pg'`到你的Gemfile。 

这是真的如果我运行bundle show pg我得到的消息:

 找不到gem'pg'。你的意思是pg? 

如果我打开我的gemfile pg宝石就在那里,但是捆绑器没有得到它! p>

任何想法来帮助这个小业余?



TNX!

解决方案

我有这个问题,使用32位版本的ruby而不是64位。你需要确保devkit也匹配你的版本。所以如果你有64位版本的安装,那么也需要改变。


first time on forum so i will try to be as specific as one can be, sorry for any possible typos ok?

I am relatively new to rails (less than a year), and i want to make a default project to work with it. I have always used sqlite3 in development and pg in production (heroku), but now i want to make things right (i've encountered problems with sqlite3 running ok but pg not) and use both pg in production and devlop.

I have spent 2 days searching foruns and all the anwsers are old or other versions/other OS.

I'll try to list the steps i took for setting up my stage: Here my configs:

-OS: Windows 7 64x
-Editor: Aptana Studio
-PostGresql
-Rails 4.0.0.rc1
-Ruby 2.0

  1. Download and Install postgresql-9.2.4-1-windows-x64
  2. Set a default Password to postgresql
  3. Create an Role "my_user" in postgresql with all privilegies
  4. Create an testing database "rails_test"
  5. Open Aptana Studio and init an new default project going to the project folder and than running "rails new . -d postgresql" for generate the new project.
  6. Install the pg gem "gem install pg" "gem list" shows the pg gem correctly
  7. configure "database.yml" for using the correct username and password

    development:
      adapter: postgresql
      encoding: unicode
      database: rails_test
      pool: 5
      username: my_user
      password: 12345
    

  8. Running some commands in ruby like "gem update", "bundle install"

then when i try to generate an model and use rake db:migrate i get the following error:

    Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile.

and it's true if i run "bundle show pg" i get the message:

    Could not find gem 'pg'. Did you mean pg? 

If i open my gemfile the pg gem is there, but the bundler is not getting it !

Any ideias to help this little amateur?

TNX !

解决方案

I had this problem and solved it by using the 32bit version of ruby rather than the 64bit. You need to make sure the devkit matches up to your version as well. So if you have the 64 bit version of that installed then that will need to be changed too.

这篇关于为什么我不能安装postgreSQL与rails 4.0.0.rc1(ruby 2.0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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