Re: Beginner problem

Katie Kelly
Sat, 22 Dec 2007 22:32:02 -0000

Hello.

Unfortunately, I think the tutorial that you are working with is a bit
out of date.  I think you''ll probably run into trouble with most of
the Rails tutorials out there right now if you''re using Rails 2.0.x
because scaffold has been deprecated.  If you Google for ''rails
scaffold deprecated'' or something similar you should be able to find
some more information about it.

Katie

On Dec 22, 3:52 pm, Sean Foley
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:
> Hey all you RoR experts/fanatics!
>
> Let me start by saying: If this is the wrong forum to post in, I humbly
> apologize.
>
> I am not normally a forum junkie or anything, but after spending 4 days
> reading half a dozen different tutorials on Ruby on Rails and trying to
> get a really tiny little application up and running, I have run into a
> brick wall that I cannot get past and I am getting desperate for help.
>
> The current tutorial I am working with
is:http://www-128.ibm.com/developerworks/library/l-rubyrails/index.html
>
> (Please let me re-emphasize here that I have read 5-6 different
> tutorials now. Please--for the love of God--do not refer me to another
> tutorial. They aren''t working for me)
>
> From top to bottom, here is what I have done:
>
> (1) I am using my Macbook running Leopard. It has ruby pre-installed and
> I have run the update rails gem. I also am using PostgreSQL (rather than
> the MySQL that all of the tutorials use because I am more familiar with
> PostgreSQL)
>
> (2) I created a database called "railstest01" in ~/db
>     export PGDATA=~/db/railstest01
>     initdb
>     createdb railstest01
>     psql railstest01
>
>     (then, inside psql, I just created a little test table...)
>     CREATE TABLE Friends (
>         id SERIAL NOT NULL,
>         name TEXT NOT NULL,
>         PRIMARY KEY (id)
>     );
>
>     INSERT INTO Friends (name) VALUES (''Tiffie'');
>     INSERT INTO Friends (name) VALUES (''Stephen'');
>     INSERT INTO Friends (name) VALUES (''Mike'');
>     ...
>
> (2) rails railstest01
>
> (3) I changed ~/railstest01/config/database.yml to be
>
> development:
>   adapter: postgresql
>   database: railstest01
>   host: localhost
>   username: postgres
>   password: 12345
>   timeout: 5000
>
> (Note: On the Macbook, I have to create a user called "postgres"
in
> order to use PostgreSQL--at least, that''s what I read...)
>
> (4) ruby script/generate model friend
>
> (5) ruby script/generate controller friend
>
> (6) I changed ~/railstest01/app/controllers/friend_controller.rb to be
>
> class FriendController < ApplicationController
>   model :friend
>   scaffold :friend
> end
>
> (7) ruby script/server
>
> (8) I then browsed to:http://localhost:3000/and successfully saw the
> "Welcome Aboard! You''re riding Ruby on Rails!" splash
screen.
>
> (9) Lastly, I browsed tohttp://localhost:3000/friend/and was hoping to
> see the screen that all the various tutorials told me I would see that
> lets me edit the tiny little database.
>
> However... I have yet to be able to do that. I keep getting the same
> error (both on my Macbook and on the domain I registered so that I could
> play around with Ruby on Rails more publicly). Below is the entire error
> I am getting.
>
> If someone could please help me clear up this issue, I would be
> extremely grateful. I am on break from the University and was hoping to
> mess around with RoR and become a devoted junkie, but I am thus far
> unable to even get my "foot in the door."
>
> --------------------------------
> THE ERROR
> --------------------------------
>  NoMethodError in FriendController#index
>
> undefined method `model'' for FriendController:Class
>
> RAILS_ROOT: /Users/postgres/ruby/railstest01
> Application Trace | Framework Trace | Full Trace
>
> app/controllers/friend_controller.rb:2
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:in
> `load_without_new_constant_marking''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:in
> `load_file''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
> `new_constants_in''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:202:in
> `load_file''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:94:in
> `require_or_load''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:248:in
> `load_missing_constant''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:453:in
> `const_missing''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:465:in
> `const_missing''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/inflector.rb:257:in
> `constantize''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/core_ext/string/inflections.rb:148:in
> `constantize''
>
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/routing.rb:1426:in
> `recognize''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
> `load''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
> `load''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
> `new_constants_in''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
> `load''
> /Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/commands/servers/mongrel.rb:64
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in
> `require''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
> `new_constants_in''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in
> `require''
> /Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39
>
>
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:170:in
> `handle_request''
>
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in
> `dispatch''
>
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in
> `dispatch_cgi''
>
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in
> `dispatch''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:78:in
> `process''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:76:in
> `synchronize''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:76:in
> `process''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:618:in
> `process_client''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in
> `each''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in
> `process_client''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in
> `run''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in
> `initialize''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in
> `new''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in
> `run''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in
> `initialize''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in
> `new''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in
> `run''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:271:in
> `run''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:270:in
> `each''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:270:in
> `run''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:127:in
> `run''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/command.rb:211:in
> `run''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:243
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in
> `gem_original_require''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in
> `require''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in
> `gem_original_require''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in
> `require''
> script/server:3
>
> app/controllers/friend_controller.rb:2
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:in
> `load_without_new_constant_marking''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:in
> `load_file''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
> `new_constants_in''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:202:in
> `load_file''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:94:in
> `require_or_load''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:248:in
> `load_missing_constant''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:453:in
> `const_missing''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:465:in
> `const_missing''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/inflector.rb:257:in
> `constantize''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/core_ext/string/inflections.rb:148:in
> `constantize''
>
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/routing.rb:1426:in
> `recognize''
>
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:170:in
> `handle_request''
>
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in
> `dispatch''
>
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in
> `dispatch_cgi''
>
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in
> `dispatch''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:78:in
> `process''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:76:in
> `synchronize''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:76:in
> `process''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:618:in
> `process_client''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in
> `each''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in
> `process_client''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in
> `run''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in
> `initialize''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in
> `new''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in
> `run''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in
> `initialize''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in
> `new''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in
> `run''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:271:in
> `run''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:270:in
> `each''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:270:in
> `run''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:127:in
> `run''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/command.rb:211:in
> `run''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:243
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
> `load''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
> `load''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
> `new_constants_in''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
> `load''
> /Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/commands/servers/mongrel.rb:64
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in
> `gem_original_require''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in
> `require''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in
> `require''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
> `new_constants_in''
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in
> `require''
> /Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in
> `gem_original_require''
>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in
> `require''
> script/server:3
>
> Request
>
> Parameters:
>
> None
>
> Show session dump
>
> ---
> flash: !map:ActionController::Flash::FlashHash {}
>
> Response
>
> Headers:
>
> {"cookie"=>[],
>  "Cache-Control"=>"no-cache"}
> --
> Posted viahttp://www.ruby-forum.com/.