Help: My first rails app - routing error


#1

After entering the command “rails server” I’m left with the following:
/home/roberto/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /home/roberto/.rbenv/versions in PATH, mode 040777
=> Booting Puma
=> Rails 5.2.1 application starting in development
=> Run rails server -h for more startup options
Puma starting in single mode…

  • Version 3.12.0 (ruby 2.5.1-p57), codename: Llamas in Pajamas
  • Min threads: 5, max threads: 5
  • Environment: development
  • Listening on tcp://0.0.0.0:3000
    Use Ctrl-C to stop
    Started GET “/cars” for 127.0.0.1 at 2018-08-19 09:47:06 -0600

ActionController::RoutingError (No route matches [GET] “/cars”):

actionpack (5.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:65:in call' web-console (3.6.2) lib/web_console/middleware.rb:135:incall_app’
web-console (3.6.2) lib/web_console/middleware.rb:30:in block in call' web-console (3.6.2) lib/web_console/middleware.rb:20:incatch’
web-console (3.6.2) lib/web_console/middleware.rb:20:in call' actionpack (5.2.1) lib/action_dispatch/middleware/show_exceptions.rb:33:incall’
railties (5.2.1) lib/rails/rack/logger.rb:38:in call_app' railties (5.2.1) lib/rails/rack/logger.rb:26:inblock in call’
activesupport (5.2.1) lib/active_support/tagged_logging.rb:71:in block in tagged' activesupport (5.2.1) lib/active_support/tagged_logging.rb:28:intagged’
activesupport (5.2.1) lib/active_support/tagged_logging.rb:71:in tagged' railties (5.2.1) lib/rails/rack/logger.rb:26:incall’
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in call' actionpack (5.2.1) lib/action_dispatch/middleware/remote_ip.rb:81:incall’
actionpack (5.2.1) lib/action_dispatch/middleware/request_id.rb:27:in call' rack (2.0.5) lib/rack/method_override.rb:22:incall’
rack (2.0.5) lib/rack/runtime.rb:22:in call' activesupport (5.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:29:incall’
actionpack (5.2.1) lib/action_dispatch/middleware/executor.rb:14:in call' actionpack (5.2.1) lib/action_dispatch/middleware/static.rb:127:incall’
rack (2.0.5) lib/rack/sendfile.rb:111:in call' railties (5.2.1) lib/rails/engine.rb:524:incall’
puma (3.12.0) lib/puma/configuration.rb:225:in call' puma (3.12.0) lib/puma/server.rb:658:inhandle_request’
puma (3.12.0) lib/puma/server.rb:472:in process_client' puma (3.12.0) lib/puma/server.rb:332:inblock in run’
puma (3.12.0) lib/puma/thread_pool.rb:133:in `block in spawn_thread’
Started GET “/cars” for 127.0.0.1 at 2018-08-19 09:48:14 -0600

ActionController::RoutingError (No route matches [GET] “/cars”):

actionpack (5.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:65:in call' web-console (3.6.2) lib/web_console/middleware.rb:135:incall_app’
web-console (3.6.2) lib/web_console/middleware.rb:30:in block in call' web-console (3.6.2) lib/web_console/middleware.rb:20:incatch’
web-console (3.6.2) lib/web_console/middleware.rb:20:in call' actionpack (5.2.1) lib/action_dispatch/middleware/show_exceptions.rb:33:incall’
railties (5.2.1) lib/rails/rack/logger.rb:38:in call_app' railties (5.2.1) lib/rails/rack/logger.rb:26:inblock in call’
activesupport (5.2.1) lib/active_support/tagged_logging.rb:71:in block in tagged' activesupport (5.2.1) lib/active_support/tagged_logging.rb:28:intagged’
activesupport (5.2.1) lib/active_support/tagged_logging.rb:71:in tagged' railties (5.2.1) lib/rails/rack/logger.rb:26:incall’
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in call' actionpack (5.2.1) lib/action_dispatch/middleware/remote_ip.rb:81:incall’
actionpack (5.2.1) lib/action_dispatch/middleware/request_id.rb:27:in call' rack (2.0.5) lib/rack/method_override.rb:22:incall’
rack (2.0.5) lib/rack/runtime.rb:22:in call' activesupport (5.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:29:incall’
actionpack (5.2.1) lib/action_dispatch/middleware/executor.rb:14:in call' actionpack (5.2.1) lib/action_dispatch/middleware/static.rb:127:incall’
rack (2.0.5) lib/rack/sendfile.rb:111:in call' railties (5.2.1) lib/rails/engine.rb:524:incall’
puma (3.12.0) lib/puma/configuration.rb:225:in call' puma (3.12.0) lib/puma/server.rb:658:inhandle_request’
puma (3.12.0) lib/puma/server.rb:472:in process_client' puma (3.12.0) lib/puma/server.rb:332:inblock in run’
puma (3.12.0) lib/puma/thread_pool.rb:133:in `block in spawn_thread’

On the browser I get a screen saying “routing error”


#2

Hey @krmaxwell88

Can you post the contents of the routes.rb file that can be found in the config directory in the rails app.


#3

i am having the same problem could you please help me
Rails.application.routes.draw do

For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html

end


#4

@amdosa

I’m not sure where you got up to in the install guide but step 4.5.3 here https://www.theodinproject.com/courses/web-development-101/lessons/your-first-rails-application covers modifying the routes file.