Ich habe versucht, eine Antwort für ein paar Tage zu finden, aber nichts gefunden. Ich weiß, dass es viele ähnliche Fragen gibt, aber sie können mir nicht helfen.Routen, die nach dem Neustart des Terminals fehlen. Rails 5.0.1
Ich habe begonnen, Rails mit http://guides.rubyonrails.org/getting_started.html zu lernen und ging weiter bis zum Terminalneustart. Hier ist eine Fehlermeldung und Code-Beispiele:
[email protected]:~/blog$ rails routes
/home/walker/.rvm/gems/ruby-2.3.1/gems/railties-5.0.1/lib/rails/app_loader.rb:40:
warning: Insecure world writable dir
/home/walker/.rvm/gems/[email protected]/bin in PATH, mode 040777
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:
* development - set it to false
* test - set it to false (unless you use a tool that preloads your test environment)
* production - set it to true
You don't have any routes defined!
Please add some routes in config/routes.rb.
For more information about routes, see the Rails guide: http://guides.rubyonrails.org/routing.html.
routes.rb:
Rails.application.routes.draw do
root 'welcome#index'
resources :articles
end
config/Umgebungen/development.rb:
config.eager_load = false
config/Umgebungen /test.rb:
config.eager_load = false
config/Umgebungen/production.rb
config.eager_load = true
Start Server:
[email protected]:~/blog$ rails s
/home/walker/.rvm/gems/ruby-2.3.1/gems/railties-5.0.1/lib/rails/app_loader.rb:40:
warning: Insecure world writable dir /home/walker/.rvm/gems/[email protected]/bin in PATH, mode 040777
=> Booting Puma
=> Rails 5.0.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:
* development - set it to false
* test - set it to false (unless you use a tool that preloads your test environment)
* production - set it to true
Puma starting in single mode...
* Version 3.7.0 (ruby 2.3.1-p112), codename: Snowy Sagebrush
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
Lokaler Host Anzeige Fehlermeldung:
Die Seite, die Sie gesucht haben Doesn Ich existiere nicht.
Möglicherweise haben Sie die Adresse falsch eingegeben, oder die Seite wurde möglicherweise verschoben.
Console Ausgabe:
Started GET "/" for 127.0.0.1 at 2017-02-01 16:59:46 +0200 Started GET
"/" for 127.0.0.1 at 2017-02-01 16:59:46 +0200
ActionController::RoutingError (No route matches [GET] "/"):
ActionController::RoutingError (No route matches [GET] "/"):
actionpack (5.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:53:in `call'
web-console (3.4.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.4.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `catch'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.0.1) lib/rails/rack/logger.rb:24:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.1) lib/rails/engine.rb:522:in `call'
puma (3.7.0) lib/puma/configuration.rb:226:in `call'
puma (3.7.0) lib/puma/server.rb:578:in `handle_request'
puma (3.7.0) lib/puma/server.rb:415:in `process_client'
puma (3.7.0) lib/puma/server.rb:275:in `block in run'
puma (3.7.0) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
Was Sie vorschlagen, um dieses Problem beheben?
Hinweis: All diese Sachen funktionierten gut bis zum Neustart des Terminals.
P.S. Ich habe eine andere App erstellt, und sie funktioniert bis zum Neustart des Terminals.
P.P.S. Ich verwende Linux Subsystem auf Windows 10 Pro.
P.P.S. Ich kann keine Linux-Distribution verwenden oder MacBook kaufen
Basierend auf dem ersten Teil, wie sind Ihre Datei Berechtigungen für routes.rb? – lcguida
@Icguida nette Frage! Ich renne ls -la, aber es gibt keine routes.rb in der Konsolenausgabe. Übrigens, ich kann routes.rb über Sublime oder Explorer finden. Dateiberechtigungen zum Config-Ordner sind 0777 –