Hi, I''m new to Ruby on Rails and am having a little difficulty working through the ''Rolling with Ruby on Rails'' tutorial. Can anyone help? I''m trying to get the cookbook application to work via a Postgresql db. But get the following error when trying to access http://127.0.0.1:3000/recipe/new Errno::EINVAL in RecipeController#new Invalid argument RAILS_ROOT: ./script/../config/.. I''m using Ruby version ruby182-15.exe (Windows XP Home) running Postgresql version 8.1 Here''s the console output: C:\InstantRails\rails_apps\cookbook>ruby script/server => Booting WEBrick... => Rails application started on http://0.0.0.0:3000 => Ctrl-C to shutdown server; call with --help for options [2006-05-22 00:32:20] INFO WEBrick 1.3.1 [2006-05-22 00:32:20] INFO ruby 1.8.2 (2004-12-25) [i386-mswin32] [2006-05-22 00:32:20] INFO WEBrick::HTTPServer#start: pid=2684 port=3000 127.0.0.1 - - [22/May/2006:00:32:26 GMT Standard Time] "GET /recipe/new HTTP/1.1 " 500 12418 - -> /recipe/new Any ideas as to what I''m doing wrong? Thanks for any help... Sorry if this is a total newbie question!! -- Posted via http://www.ruby-forum.com/.
Craig, I worked through this tutorial with Postgres many months ago; I know it works with Postgres, but the fine details of any tweaks I applied aren''t exactly fresh in my mind. That said, my guess is that you''ve got an error in your view or controller, rather than some sort of Postgres issue. Check for any typos; if you can''t find any, then post the full stack trace of your error message which will probably give a better indication about where things went off the <groan> rails </groan>. Regards Dave M. On 22/05/06, Craig McDonnell <c.mcdonnell@sporttrain.net> wrote:> Hi, I''m new to Ruby on Rails and am having a little difficulty working > through the ''Rolling with Ruby on Rails'' tutorial. Can anyone help? > > I''m trying to get the cookbook application to work via a Postgresql db. > But get the following error when trying to access > http://127.0.0.1:3000/recipe/new > > Errno::EINVAL in RecipeController#new > Invalid argument > RAILS_ROOT: ./script/../config/.. > > I''m using Ruby version ruby182-15.exe (Windows XP Home) running > Postgresql version 8.1 > > Here''s the console output: > > C:\InstantRails\rails_apps\cookbook>ruby script/server > => Booting WEBrick... > => Rails application started on http://0.0.0.0:3000 > => Ctrl-C to shutdown server; call with --help for options > [2006-05-22 00:32:20] INFO WEBrick 1.3.1 > [2006-05-22 00:32:20] INFO ruby 1.8.2 (2004-12-25) [i386-mswin32] > [2006-05-22 00:32:20] INFO WEBrick::HTTPServer#start: pid=2684 port=3000 > 127.0.0.1 - - [22/May/2006:00:32:26 GMT Standard Time] "GET /recipe/new > HTTP/1.1 > " 500 12418 > - -> /recipe/new > > Any ideas as to what I''m doing wrong? Thanks for any help... Sorry if > this is a total newbie question!! > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Wow! Thanks for the quick response David. Here are the details. recipe_controller.rb: class RecipeController < ApplicationController scaffold :recipe end Full trace is: c:/ruby/lib/ruby/1.8/readbytes.rb:16:in `read'' c:/ruby/lib/ruby/1.8/readbytes.rb:16:in `readbytes'' c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/message.rb:32:in `read'' c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/connection.rb:30:in `initialize'' c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/connection.rb:29:in `loop'' c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/connection.rb:29:in `initialize'' c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/postgres-compat.rb:23:in `new'' c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/postgres-compat.rb:23:in `initialize'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/postgresql_adapter.rb:24:in `connect'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/postgresql_adapter.rb:24:in `postgresql_connection'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in `send'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in `connection_without_query_cache='' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/query_cache.rb:54:in `connection='' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:220:in `retrieve_connection'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:696:in `columns'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1969:in `attributes_from_column_definition'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1351:in `initialize_without_callbacks'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/callbacks.rb:236:in `initialize'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/scaffolding.rb:124:in `new'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/scaffolding.rb:124:in `new'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:910:in `send'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:910:in `perform_action_without_filters'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in `measure'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in `perform_action'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in `send'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in `process_without_filters'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in `process_without_session_management_support'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in `process'' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in `dispatch'' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:in `handle_dispatch'' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:in `service'' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' c:/ruby/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'' c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start'' c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'' c:/ruby/lib/ruby/1.8/webrick/server.rb:94:in `start'' c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `each'' c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `start'' c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:in `dispatch'' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59 c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require__'' c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30 c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require__'' c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'' script/server:3 And session dump is: --- flash: !ruby/hash:ActionController::Flash::FlashHash {} -- Posted via http://www.ruby-forum.com/.
I just did the tutorial with postgres (I like Postgres as it is a ACID complaint DB), it worked find. Can you post the code of your controller I may be able to do a quick comparison check. Some strange errors messages occur with rails. -- Posted via http://www.ruby-forum.com/.
Sure: class RecipeController < ApplicationController scaffold :recipe end Could you perhaps describe which versions of each file you were using? And which/how you installed the postgres interpreter? Maybe I''m using incompatible versions. Thanks for your help. -- Posted via http://www.ruby-forum.com/.
Also, does it matter which encoding is used for the postgresql db? -- Posted via http://www.ruby-forum.com/.
I doubt that matters. From your backtrace it is having trouble connecting to the database at initialization time, do you have a firewall or something like that ... Here''s a stanza from my database.yml ... development: adapter: postgresql database: rosebank_development username: guido password: encoding: UTF8 host: localhost port: 5444 What does your database.yml say? If the problem persists, you may want to try using the Unix sockets to connect instead .. -- G. On May 22, 2006, at 4:27 PM, Craig McDonnell wrote:> Also, does it matter which encoding is used for the postgresql db? > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
On May 22, 2006, at 9:27 AM, Craig McDonnell wrote:> Also, does it matter which encoding is used for the postgresql db?it depends on the encoding requirements of your application. :-) ..but for any generic Rails application... no... You might try the postgres adapter not the postgres-pr one. 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]