Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTong Vang
9,926 PointsProblem with Rails: Why is it saying Routing Error?
Command line output:
Started GET "/sign_up" for 127.0.0.1 at 2014-05-21 17:53:40 -0700 ActiveRecord::SchemaMigration Load (1.0ms) SELECT "schema_migrations".* FROM "schema_migrations"
ActionController::RoutingError (No route matches [GET] "/sign_up"):
actionpack (4.1.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in c
all'
actionpack (4.1.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in
ca
ll'
railties (4.1.1) lib/rails/rack/logger.rb:38:in call_app'
railties (4.1.1) lib/rails/rack/logger.rb:20:in
block in call'
activesupport (4.1.1) lib/active_support/tagged_logging.rb:68:in block in tag
ged'
activesupport (4.1.1) lib/active_support/tagged_logging.rb:26:in
tagged'
activesupport (4.1.1) lib/active_support/tagged_logging.rb:68:in tagged'
railties (4.1.1) lib/rails/rack/logger.rb:20:in
call'
actionpack (4.1.1) lib/action_dispatch/middleware/request_id.rb:21:in call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in
call'
rack (1.5.2) lib/rack/runtime.rb:17:in call'
activesupport (4.1.1) lib/active_support/cache/strategy/local_cache_middleware
.rb:26:in
call'
rack (1.5.2) lib/rack/lock.rb:17:in call'
actionpack (4.1.1) lib/action_dispatch/middleware/static.rb:64:in
call'
rack (1.5.2) lib/rack/sendfile.rb:112:in call'
railties (4.1.1) lib/rails/engine.rb:514:in
call'
railties (4.1.1) lib/rails/application.rb:144:in call'
rack (1.5.2) lib/rack/lock.rb:17:in
call'
rack (1.5.2) lib/rack/content_length.rb:14:in call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in
service'
C:/Ruby200/lib/ruby/2.0.0/webrick/httpserver.rb:138:in service'
C:/Ruby200/lib/ruby/2.0.0/webrick/httpserver.rb:94:in
run'
C:/Ruby200/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
Rendered C:/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.1.1/lib/action_dispa tch/middleware/templates/rescues/_trace.html.erb (2.0ms) Rendered C:/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.1.1/lib/action_dispa tch/middleware/templates/routes/_route.html.erb (4.0ms) Rendered C:/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.1.1/lib/action_dispa tch/middleware/templates/routes/_table.html.erb (49.0ms) Rendered C:/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.1.1/lib/action_dispa tch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (3 16.0ms)
Brower output:
No route matches [GET] "/sign_up"
Rails.root: C:/Users/Tom/treebook
3 Answers
Lisa Rossiter
3,630 PointsFirst port of call is normally rake routes then routes.rb
Could you post both up.
Tong Vang
9,926 Pointsrake routes:
Prefix Verb URI Pattern Controller#Action
new_user_session GET /users/sign_in(.:format) devise/sessions#n
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registratiions#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PATCH /users(.:format) devise/registrations#update
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
statuses GET /statuses(.:format) statuses#index
POST /statuses(.:format) statuses#create
new_status GET /statuses/new(.:format) statuses#new
edit_status GET /statuses/:id/edit(.:format) statuses#edit
status GET /statuses/:id(.:format) statuses#show
PATCH /statuses/:id(.:format) statuses#update
PUT /statuses/:id(.:format) statuses#update
DELETE /statuses/:id(.:format) statuses#destroy
root GET / statuses#index
routes.rb:
Rails.application.routes.draw do
devise_for :users
resources :statuses
root to: 'statuses#index'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
Lisa Rossiter
3,630 PointsI am just going to pot this and hope you figure it out :)
new_user_registration GET /users/sign_up(.:format) devise/registratiions#new