0

我是一名铁路新手。我正在努力让一个简单的 helloworld rails 应用程序(无数据库)在共享主机上工作。

开发日志

Processing ApplicationController#index (for 122.61.170.222 at 2012-12-17 17:46:09) [GET]

ActionController::RoutingError (No route matches "/Say/hello" with {:method=>:get}):


Rendering rescues/layout (not_found)

我的导轨设置:http ://scifiwear.com/rails_setup.png

导轨设置 http://scifiwear.com/rails_setup.png

我的子域设置:http ://scifiwear.com/subdomain.png

子域设置 http://scifiwear.com/subdomain.png

服务器版本:

Ruby 版本:1.8.7 Gem 版本:1.8.16 Rails 是 2.3.14

我配置 helloWorld 应用程序的步骤:

  1. 使用 Web 表单创建应用程序http://scifiwear.com/rails_setup.png

  2. cd myapp14

  3. ruby 脚本/生成控制器说再见

  4. http://myapp14.scifiwear.com/ 快乐!

5 http://myapp14.scifiwear.com/say/hello不开心!

杂种日志:

Mon Dec 17 17:46:09 -0600 2012: Error calling Dispatcher.dispatch #<NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.split>
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/cgi_process.rb:52:in `dispatch_cgi'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:101:in `dispatch_cgi'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:27:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:76:in `process'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in `process'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:159:in `process_client'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in `each'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in `process_client'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `initialize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `new'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `initialize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `new'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:282:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:281:in `each'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:281:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
/usr/bin/mongrel_rails:19:in `load'
/usr/bin/mongrel_rails:19

我的 routes.rb 的最后 4 行:(未触及)

# consider removing or commenting them out if you're using named routes and resources.

map.connect ':controller/:action/:id'

map.connect ':controller/:action/:id.:format'

end

任何建议表示感谢。

4

1 回答 1

0

尝试为上一个问题给出的答案:在共享托管服务器上运行 Ruby on Rails 应用程序的问题;在这种情况下,它们可能会有所帮助。

我尝试在本地重现相同的错误,使用rails 2.3.14and ruby 1.8.7-p371; 没有收到错误信息。路由文件与您所拥有的类似。

日志跟踪如下:

=> Booting Mongrel
=> Rails 2.3.14 application starting on http://0.0.0.0:3000
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /Users/hallelujah/.rvm/gems/ruby-1.8.7-p371@hallelujah/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /Users/hallelujah/.rvm/gems/ruby-1.8.7-p371@hallelujah/gems/rails-2.3.14/lib/rails/vendor_gem_source_index.rb:100.
=> Call with -d to detach
=> Ctrl-C to shutdown server


Processing SayController#hello (for 127.0.0.1 at 2012-12-20 15:52:23) [GET]
Rendering say/hello
Completed in 35ms (View: 34, DB: 0) | 200 OK [http://localhost/say/hello]

鉴于此托管服务器上的 ruby​​ 和 rails 版本非常旧,您可能很难获得有关此安装所面临问题的帮助。而且您在学习这些概念时也会遇到困难。

我的建议是让您切换到使用最新版本的 ruby​​ 和 rails(并了解使用 rails 进行 Web 开发的最佳实践),遵循 Michael Hartl 的优秀且免费提供的在线书籍:Ruby on Rails 教程

于 2012-12-20T10:35:38.300 回答