railstutorial.org - Error when running rails server -


i following michael hartl's rails tutorial. working fine, when run "rails server" on command line following error:

=> booting webrick => rails 3.2.13 application starting in development on http://0.0.0.0:3000 => call -d detach => ctrl-c 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 hash (typeerror) /home/jonathan/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:254:in `root' /home/jonathan/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:1321:in `root' /home/jonathan/desktop/railstut/sample_app/config/routes.rb:4:in `block in <top (required)>' /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' /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' /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' /home/jonathan/desktop/railstut/sample_app/config/routes.rb:1:in `<top (required)>' . . . 

here routes.rb file

sampleapp::application.routes.draw   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 

any appreciated.

in line 4 of routes.rb should have:

root to: 'static_pages#home' 

the error occurs because, see here, root method expect parameter hash while passing string.


Comments