Error is trying to run a Biginners Tutorial. Suggestions Plz

I am getting a 500 error . I am just trying to follow this tutorial Online Tutorials Library … views.htm. After I created a new controller using this command

:\ruby\library\> ruby script/generate controller Book

I added Some methods to book_controller.rb

class BookController < ApplicationController    def list       @books = Book.find(:all)    end    def show       @book = Book.find(params[:id])    end    def new       @book = Book.new       @subjects = Subject.find(:all)    end    def create       @book = Book.new(params[:book])       if @book.save             redirect_to :action => 'list'       else             @subjects = Subject.find(:all)             render :action => 'new'       end    end    def edit       @book = Book.find(params[:id])       @subjects = Subject.find(:all)    end    def update       @book = Book.find(params[:id])       if @book.update_attributes(params[:book])          redirect_to :action => 'show', :id => @book       else          @subjects = Subject.find(:all)          render :action => 'edit'       end    end    def delete       Book.find(params[:id]).destroy       redirect_to :action => 'list'    end    def show_subjects       @subject = Subject.find(params[:id])    end end

And then I started the server throgh c:/path to my application/ruby script/server And then I went to http://localhost:3000/book/list… I am not getting the expected result which is template not found. Instead it say "we are sorry but there is some problem"

Error in my Command prompt is pasted below:

/!\ FAILSAFE /!\ Fri Nov 20 13:49:28 -0500 2009   Status: 500 Internal Server Error   Access denied for user 'prerna'@'localhost' (using password: YES)     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/mysql_adapter.rb:585:in `real_connect'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/mysql_adapter.rb:585:in `connect'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/mysql_adapter.rb:199:in `initialize'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/mysql_adapter.rb:71:in `new'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/mysql_adapter.rb:71:in `mysql_connection'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/abstract/connection_pool.rb:223:in `send'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/abstract/connection_pool.rb:223:in `new_connection'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/abstract/connection_pool.rb:188:in `checkout'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/abstract/connection_pool.rb:184:in `loop'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/abstract/connection_pool.rb:184:in `checkout'     C:/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/abstract/connection_pool.rb:183:in `checkout'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/abstract/connection_pool.rb:98:in `connection'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/abstract/connection_pool.rb:326:in `retrieve_connection'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/abstract/connection_specification.rb:123:in `retrieve_connection'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/abstract/connection_specification.rb:115:in `connection'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/query_ca che.rb:9:in `cache'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/query_ca che.rb:28:in `call'     C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/ active_record/connecti on_adapters/abstract/connection_pool.rb:361:in `call'     C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/head.rb:9:in `call'     C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/ methodoverride.rb:24:in ` call'     C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/ action_controller/params _parser.rb:15:in `call'     C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/ action_controller/sessio n/cookie_store.rb:93:in `call'     C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/ action_controller/failsa fe.rb:26:in `call'     C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call'     C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `synchroniz e'     C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call'     C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/ action_controller/dispat cher.rb:114:in `call'     C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/ action_controller/reload er.rb:34:in `run'     C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/ action_controller/dispat cher.rb:108:in `call'     C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/rack/ static.rb:31:in `c all'     C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:46:in `call'     C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `each'     C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `call'     C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/rack/ log_tailer.rb:17:i n `call'     C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/ content_length.rb:13:in ` call'     C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/ webrick.rb:50: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:173:in `start_thread'     C:/Ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'     C:/Ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'     C:/Ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'     C:/Ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'     C:/Ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'     C:/Ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'     C:/Ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'     C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/ webrick.rb:14:in `run'     C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/commands/server.rb: 111     C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_origina l_require'     C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'     script/server:3

ANY SUGGESTIONS ARE APRECIATED ....Thanks....

I think this is saying that it cannot access your mysql database with user prerna and the password specified in database.yml

The clue is usually in the trace somewhere, it can be difficult to see the bit that matters however.

Colin

To chime in on Colin's answer, look at your database.yml file and adjust your development settings to match your database settings. If you're on Mac OS X or Linux, try this from the console:

mysql -u <username in database.yml> -p <enter your database password as defined in database.yml>

If you get access, you should be ready to go. If not, open up your MySQL management console (assuming you have one, if not, mysql -u root -p <enter> then: "GRANT ALL ON table_name.* TO 'user'@'localhost' IDENTIFIED BY PASSWORD('password'); FLUSH PRIVILEGES; quit" w/o the quotes) and make sure your authentication for that user is set up correctly.