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
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!
On May 11, 2006, at 10:27 AM, c.k.lester wrote:> 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#indexIs 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]
Robby Russell wrote:> On May 11, 2006, at 10:27 AM, c.k.lester wrote: > >> 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 > > 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'' ...
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. On 5/12/06, C. K. Lester <ck@cklester.com> wrote:> > Robby Russell wrote: > > > On May 11, 2006, at 10:27 AM, c.k.lester wrote: > > > >> 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 > > > > 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'' > ... > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060512/45940821/attachment-0001.html
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
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. On May 12, 2006, at 12:05 AM, C. K. Lester wrote:> 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 > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
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. :/
You said your database was call mmc but in your database.yaml you have the development database called mmc_development On 5/12/06, C. K. Lester <ck@cklester.com> wrote:> > 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. :/ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060512/4f78ffc4/attachment.html
Daniel N wrote:> You said your database was call mmc but in your database.yaml you have > the development database called mmc_developmentI was wondering if that mattered... let me check it out. :)
Daniel N wrote:> You said your database was call mmc but in your database.yaml you have > the development database called mmc_developmentwell, it didn''t seem to matter. i rebooted WEBrick and it still gives me the same error. :/
> 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. :)it matters
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 -- Posted via http://www.ruby-forum.com/.