我正在关注 Michael Hartl 的 rails 教程。一切正常,但是当我在命令行上运行“rails server”时,出现以下错误:
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/jonathan/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/actionpack- 3.2.13/lib/action_dispatch/routing/mapper.rb:254:in `merge': can't convert String into Hash (TypeError)
from /home/jonathan/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:254:in `root'
from /home/jonathan/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:1321:in `root'
from /home/jonathan/Desktop/railsTut/sample_app/config/routes.rb:4:in `block in <top (required)>'
from /home/jonathan/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:289:in `instance_exec'
from /home/jonathan/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:289:in `eval_block'
from /home/jonathan/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:267:in `draw'
from /home/jonathan/Desktop/railsTut/sample_app/config/routes.rb:1:in `<top (required)>'
.
.
.
这是我的 routes.rb 文件
SampleApp::Application.routes.draw do
resources :users
resources :sessions, only: [:new, :create, :destroy]
root 'static_pages#home'
match '/signup', to: 'users#new', via: 'get'
match '/signin', to: 'sessions#new', via: 'get'
match '/signout', to: 'sessions#destroy', via: 'delete'
match '/help', to: 'static_pages#help'
match '/about', to: 'static_pages#about'
match '/contact', to: 'static_pages#contact'
end
任何帮助表示赞赏。