我关注this tutorial。一切顺利,直到我尝试创建一个控制器并在我的浏览器中查看它。
服务器正在运行,它显示默认页面okay(http://127.0.0.1:3000
)。
我在命令行中运行了ruby script\generate controller MyTest
,它生成了正确的文件夹和文件。
问题是,当我转到http://127.0.0.1:3000/My_Test/
时,它说:
我们很抱歉,但出了点问题。
我们已收到有关此问题的通知 我们很快就会看一下。
这一定是我在某处忽略的东西。任何帮助表示赞赏!
ruby 1.8.6
rails 2.3.4
刚检查了我的开发日志。以下是它的说法:
/!\ FAILSAFE /!\ Thu Sep 24 02:21:04 +0100 2009状态:500内部服务器错误没有要加载的此类文件 - sqlite3的 C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:在
gem_original_require' C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
需要” C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:在require' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in
new_constants_in' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:在require' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/kernel/requires.rb:7:in
require_library_or_gem” C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/kernel/reporting.rb:11:silence_warnings' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/kernel/requires.rb:5:in
require_library_or_gem” C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/sqlite3_adapter.rb:10:在sqlite3_connection' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in
发送” C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:在new_connection' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_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/connection_adapters/abstract/connection_pool.rb:188:在checkout' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in
环” C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:在checkout' C:/Ruby/lib/ruby/1.8/monitor.rb:242:in
同步” C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:在checkout' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in
连接” C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:在retrieve_connection' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in
retrieve_connection” C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:在connection' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:9:in
缓存” C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:28:在call' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in
称之为” C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/head.rb:9:在call' C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/methodoverride.rb:24:in
称之为” C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/params_parser.rb:15:在call' C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/session/cookie_store.rb:93:in
称之为” C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/failsafe.rb:26:在call' C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in
称之为” C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:synchronize' C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in
称之为” C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:114:在call' C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/reloader.rb:34:in
运行” C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:108:在call' C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/rack/static.rb:31:in
称之为” C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:46:在call' C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:40:in
每个” C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:40:在call' C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/rack/log_tailer.rb:17:in
称之为” C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/content_length.rb:13:incall' C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/handler/webrick.rb:46:in
service' C:/Ruby/lib/ruby/1.8/webrick/httpserver.rb:104:在service' C:/Ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in
运行” C:/Ruby/lib/ruby/1.8/webrick/server.rb:173:在start_thread' C:/Ruby/lib/ruby/1.8/webrick/server.rb:162:in
开始” C:/Ruby/lib/ruby/1.8/webrick/server.rb:162:在start_thread' C:/Ruby/lib/ruby/1.8/webrick/server.rb:95:in
开始” C:/Ruby/lib/ruby/1.8/webrick/server.rb:92:在each' C:/Ruby/lib/ruby/1.8/webrick/server.rb:92:in
开始” C:/Ruby/lib/ruby/1.8/webrick/server.rb:23:在start' C:/Ruby/lib/ruby/1.8/webrick/server.rb:82:in
开始” C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/handler/webrick.rb:13:在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_original_require” C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:在 `需要” 脚本/服务器:3
我不知道这意味着什么,但我注意到的一件事是它说sqlite3 - 我没有使用它(我正在使用MySql)。这是问题吗?
答案 0 :(得分:1)
您应该检查您的日志文件,以确实看到出了什么问题。您可以在rails应用程序根目录的日志目录中找到它。
但是,鉴于您正在运行开发模式,您应该看到更详细的错误消息(带有堆栈跟踪和会话信息),因此很可能是rails设置中的错误,例如配置错误的database.yml文件。 / p>
答案 1 :(得分:1)
您需要配置config / database.yml以使用mysql数据库而不是sqlite。
当您启动新的Rails项目时,您可以指定要使用的数据库:
rails -d mysql
答案 2 :(得分:1)
这是一个非常古老的教程,从那以后很多事情都发生了变化。
您可以改为this。
答案 3 :(得分:1)
你安装了sqlite3吗? Rails默认使用sqlite3数据库,当它无法找到它时会抛出此错误。
尝试“ruby gem install sqlite3”命令。