Forum: Ruby on Rails Verifying Good Setup of RoR + PostgreSQL

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D48aba5b6c3d0d7b6e80571e895a668c?d=identicon&s=25 c.k.lester (Guest)
on 2006-05-11 19:28
(Received via mailing list)
I've been reading the RoR tutorials and wiki help stuff, but I'm stuck.
:(

I've got RoR installed properly and get the "Welcome aboard! You're
riding the rails." I have an "article" controller, "article" model, and
both an "article" and "articles" views (one is a remnant, I think, and
no longer needed) (the "article" folder is empty, but "articles"
contains "edit.rhtml" and others). Does that sound workable so far?

I also have a PostgreSQL database set up called MMC, with one table
called articles, with columns of id, title, blurb, author.

How do I test this configuration?

http://MMC works fine.
http://MMC/article gives me the error message:

Errno::EINVAL in ArticleController#index

Invalid argument
Be1edce8eb69783c8036394481b1d19a?d=identicon&s=25 C. K. Lester (Guest)
on 2006-05-12 05:10
(Received via mailing list)
When I run rake, I get the following errors. Can somebody please let me
know what I can do to fix them? Thanks!

1) Error:
test_truth(ArticleControllerTest):
NameError: uninitialized constant PGconn
...

2) Error:
test_truth(ArticleControllerTest):
NameError: uninitialized constant ActiveRecord::PGconn
...

Thanks!
B84d42a3a5c343f8fc6ab7d7f47fd3f5?d=identicon&s=25 Robby Russell (Guest)
on 2006-05-12 06:33
(Received via mailing list)
On May 11, 2006, at 10:27 AM, c.k.lester wrote:

> I also have a PostgreSQL database set up called MMC, with one table
> called articles, with columns of id, title, blurb, author.
>
> How do I test this configuration?
>
> http://MMC works fine.
> http://MMC/article gives me the error message:
>
> Errno::EINVAL in ArticleController#index


Is it safe to assume that you have a model called Article?

If so... try this from the terminal/console.

ruby script/console
(wait for console to load...)
 > Article.count

What happens?


Robby


--
Robby Russell
Founder & Executive Director

PLANET ARGON, LLC
Ruby on Rails Development, Consulting & Hosting

www.planetargon.com
www.robbyonrails.com

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4968 [fax]
Be1edce8eb69783c8036394481b1d19a?d=identicon&s=25 C. K. Lester (Guest)
on 2006-05-12 06:45
(Received via mailing list)
Robby Russell wrote:

>> called articles, with columns of id, title, blurb, author.
>>
>> How do I test this configuration?
>>
>> http://MMC works fine.
>> http://MMC/article gives me the error message:
>>
>> Errno::EINVAL in ArticleController#index
>
> Is it safe to assume that you have a model called Article?

Yes. article.rb in the models folder.

> If so... try this from the terminal/console.
>
> ruby script/console
> (wait for console to load...)
> > Article.count
>
> What happens?

Error message as follows:

NameError: uninitialized constant PGconn
    from
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active-support/dependencies.rb:123:in
'const_missing'
...
9d1f5d2d9de70bd9a934f557dc95a406?d=identicon&s=25 Daniel ----- (liquid)
on 2006-05-12 07:01
(Received via mailing list)
I'm  wondering have you set up your database.yaml file in the config
directory of your rails app?

You should change the name of the database to match the one that your
using,
also provide the username and password for access to the database here.
Be1edce8eb69783c8036394481b1d19a?d=identicon&s=25 C. K. Lester (Guest)
on 2006-05-12 07:07
(Received via mailing list)
Daniel N wrote:

> I'm  wondering have you set up your database.yaml file in the config
> directory of your rails app?
>
> You should change the name of the database to match the one that your
> using, also provide the username and password for access to the
> database here.

Yes, I've done that. Here it is, sans my password...

(Oh, one thing... my database is called mmc.)

# MySQL (default setup).  Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
#   gem install mysql
# On MacOS X:
#   gem install mysql -- --include=/usr/local/lib
# On Windows:
#   There is no gem for Windows.  Install mysql.so from RubyForApache.
#   http://rubyforge.org/projects/rubyforapache
#
# And be sure to use new-style password hashing:
#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
  adapter: postgresql
  database: mmc_development
  username: postgres
  password: ***
  host: localhost

# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
  adapter: postgresql
  database: mmc_test
  username: postgres
  password: ***
  host: localhost

production:
  adapter: postgresql
  database: mmc_production
  username: postgres
  password: ***
  host: localhost
0b6c03456c7606f5b95629228eb7a85a?d=identicon&s=25 Jim Hughes (Guest)
on 2006-05-12 07:22
(Received via mailing list)
Looks to me like the "uninitialized constant" is the postgres
connection class.  Do you have the postgres gems installed?  I've
never used postgres with rails, so I can't really advise you on
setting it up.
Be1edce8eb69783c8036394481b1d19a?d=identicon&s=25 C. K. Lester (Guest)
on 2006-05-12 07:25
(Received via mailing list)
Jim Hughes wrote:

> Looks to me like the "uninitialized constant" is the postgres
> connection class.  Do you have the postgres gems installed?  I've
> never used postgres with rails, so I can't really advise you on
> setting it up.

Yes. The last one I loaded was 'gem install ruby-postgres' the one they
say to use but could be buggy. but i was also using one before that that
didn't seem to work either. :/
9d1f5d2d9de70bd9a934f557dc95a406?d=identicon&s=25 Daniel ----- (liquid)
on 2006-05-12 07:34
(Received via mailing list)
You said your database was call mmc but in your database.yaml you have
the
development database called mmc_development
Be1edce8eb69783c8036394481b1d19a?d=identicon&s=25 C. K. Lester (Guest)
on 2006-05-12 07:58
(Received via mailing list)
Daniel N wrote:

> You said your database was call mmc but in your database.yaml you have
> the development database called mmc_development

I was wondering if that mattered... let me check it out. :)
Be1edce8eb69783c8036394481b1d19a?d=identicon&s=25 C. K. Lester (Guest)
on 2006-05-12 08:02
(Received via mailing list)
Daniel N wrote:

> You said your database was call mmc but in your database.yaml you have
> the development database called mmc_development

well, it didn't seem to matter. i rebooted WEBrick and it still gives me
the same error. :/
E49eab7677b4696db754b356953b9eac?d=identicon&s=25 Ivan Acosta-rubio (ivanacostarubio)
on 2009-10-23 22:52
C. K. Lester wrote:
> When I run rake, I get the following errors. Can somebody please let me
> know what I can do to fix them? Thanks!
>
> 1) Error:
> test_truth(ArticleControllerTest):
> NameError: uninitialized constant PGconn
> ...
>
> 2) Error:
> test_truth(ArticleControllerTest):
> NameError: uninitialized constant ActiveRecord::PGconn
> ...
>
> Thanks!


It may be because you have an initializer in /config/initializers like:

def PGconn.quote_ident(name)
    %("#{name}")
end

Look in the entire project for: pgconn
This topic is locked and can not be replied to.