PostgreSQL with RubyStack: Postgres Gem Problem
|
|
I started the Rubyconsole and tried the following commands: bash-3.2$ cd /home/ehsanul/newapp Part of the result and trace: (in /home/ehsanul/newapp)
I know my adapter in database.yml is set correctly to “postgresql”. And I knew I had the postgres gem installed, which I checked by doing gem list from the linux terminal (outside of rubyconsole), which showed me this: ehsanul@ehsanul-laptop:~$ gem list
actionmailer (2.1.1, 2.0.2) Postgres is obviously there. So then I tried the same command in the rubyconsole: bash-3.2$ gem list
actionmailer (2.0.2) Now the problem is clear, the gem really isn’t accessible by rubyconsole for some reason. But how do I add the postgres gem in such a way that it is recognized within rubyconsole? I tried installing from rubyconsole, it made no difference. |
|
|
Hi ehsanul, BitNami RubyStack is independent of your system. When you tiped gem list in your terminal (outside of rubyconsole) you are seeing the system installed gems and you have installed postgres gem. It is necessary to install the postgres gem into the rubyconsole. Probably this gem needs to specify the folders where is postgresql installed. You can find more info about how to install this gem at http://wiki.rubyonrails.org/rails/pages/PostgreSQL I hope it helps |
|
|
Thanks for replying beltran Well, I realized that when I tried gem list from the two different consoles. My question is, how do I install it into the rubyconsole? I’m new to rails, and obviously to the rubyconsole as well, so I have no idea. Thanks for the link, but I saw that page a few days ago, and it did help me with some earlier problems. But not this one. I’ve tried specifying the postgresql folders to install the gem there by running a command like: $ gem install postgres Or even: $ gem install postgres——with-pgsql-include-dir=/usr/include—with-pgsql-lib-dir=/usr/lib But this didn’t help. Rubyconsole is unable to find the gem. |
|
|
Sorry, those commands should be: $ gem install postgres—with-pgsql-include-dir=/opt/PostgreSQL/8.3/include – -with-pgsql-lib-dir=/opt/PostgreSQL/8.3/lib Or even: $ gem install postgres—with-pgsql-include-dir=/usr/include—with-pgsql-lib-dir=/usr/lib |
|
|
Hi ehsaul, The rubyconsole it is similar to you console, only that this console preload the Stack environment variables. For example, if you execute “which ruby” in a simple terminal you can realize that you are using the ruby system command and if you execute:
You can see that you are using the ruby Stack command. It occurs the same with “gem” or another command. So if you want to install the postgres gem in your RubyStack you only should execute these commands:
Maybe it is necessary to include other options as you said in the previous post. The “gem install” command try to download from a gem repository the gem, why did you say that “Rubyconsole is unable to find the gem”? What is the exact error? Cheers |
|
|
Nevermind, I did a lot of different things and finally figured it out, plus a few more problems. But finally, Rubystack is working with PostgreSQL (as far as I can tell for now), and I’m happy. :) Thanks anyway. |
|
|
I’m glad to hear this :) |
|
|
Thanks for that explanation beltran, had not seen it before posting the last time. Yes, I knew how to get into the rubyconsole and I did gem install postgres from there. And it would tell me that it had installed. But it wasn’t there, and it wasn’t working. I tried the command gem environment, and it showed me the default installation directory of the installation was correct. But when I check in that directory, all the other gems besides postgres was there, but no postgres. So I did a file search for “postgres-0.7.9.2008” which was part of the filename of the postgres gem. I found out that it had been installed, but in a subtly different directory. The default directory for installation is ”/home/ehsanul/rubystack/ruby/lib/ruby/gems/1.8”, but I found the postgres gem installed in ”/home/ehsanul/rubystack/ruby/lib/ruby/1.8/gems” (this is veryyy slightly different, hard to catch), all by itself, with no other gems there. I have no idea why rubyconsole installed it there when the gem environment command clearly shows the correct default installation directory. So outside the rubyconsole, I ran the following command: $ sudo gem install postgress—install-dir /home/ehsanul/rubystack/ruby/lib/ruby/gems/1.8 This solved my problem. Hopefully, this may help someone else having the same problem. |
|
|
The error was “no such file to load – postgres” .. it could not find the postgres gem |
