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....