2017-02-20 1 views
0

Ich habe gerade angefangen, diesen Fehler für alle Controller zu erhalten. Nicht sicher, was passiert ist, weil ich auf der Benutzeroberfläche so CSS, ERB-Dateien arbeitete und dann lade ich die Seite neu und beginne diesen Fehler zu bekommen.Kontinuierlicher ApplicationController (alle Controller) konnte nicht automatisch geladen werden

Vielen Dank für Rat und Hilfe.

Controller: (app/Controller/...)

home_controller.rb 
application_controller.rb 

In home_controller:

class HomeController < ApplicationController 
    def index 
    end 
end 

In application_controller:

class ApplicationController < ActionController::Base 
    protect_from_forgery with: :exception 
end 

Routen:

Rails.application.routes.draw do 
    devise_for :admins, path: '', path_names: { sign_in: 'login', sign_out: 'logout'} 

    # HOME 
    root to: 'home#index' 

    # MESSENGER 
    match '/webhook', :controller => 'messenger', :action => 'callback', :via => :post 
    get '/webhook' => 'messenger#verify_callback' 
end 

Fehler: (für alle Regler gleiche Fehler außer konstant und Pfad)

LoadError (Unable to autoload constant HomeController, expected /home/ubuntu/line/app/controllers/home_controller.rb to define it): 

activesupport (5.0.1) lib/active_support/dependencies.rb:512:in `load_missing_constant' 
activesupport (5.0.1) lib/active_support/dependencies.rb:203:in `const_missing' 
activesupport (5.0.1) lib/active_support/inflector/methods.rb:268:in `const_get' 
activesupport (5.0.1) lib/active_support/inflector/methods.rb:268:in `block in constantize' 
activesupport (5.0.1) lib/active_support/inflector/methods.rb:266:in `each' 
activesupport (5.0.1) lib/active_support/inflector/methods.rb:266:in `inject' 
activesupport (5.0.1) lib/active_support/inflector/methods.rb:266:in `constantize' 
activesupport (5.0.1) lib/active_support/dependencies.rb:583:in `get' 
activesupport (5.0.1) lib/active_support/dependencies.rb:614:in `constantize' 
actionpack (5.0.1) lib/action_dispatch/http/request.rb:81:in `controller_class' 
actionpack (5.0.1) lib/action_dispatch/routing/route_set.rb:44:in `controller' 
actionpack (5.0.1) lib/action_dispatch/routing/route_set.rb:30:in `serve' 
actionpack (5.0.1) lib/action_dispatch/journey/router.rb:39:in `block in serve' 
actionpack (5.0.1) lib/action_dispatch/journey/router.rb:26:in `each' 
actionpack (5.0.1) lib/action_dispatch/journey/router.rb:26:in `serve' 
actionpack (5.0.1) lib/action_dispatch/routing/route_set.rb:725:in `call' 
warden (1.2.7) lib/warden/manager.rb:36:in `block in call' 
warden (1.2.7) lib/warden/manager.rb:35:in `catch' 
warden (1.2.7) lib/warden/manager.rb:35:in `call' 
rack (2.0.1) lib/rack/etag.rb:25:in `call' 
rack (2.0.1) lib/rack/conditional_get.rb:25:in `call' 
rack (2.0.1) lib/rack/head.rb:12:in `call' 
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context' 
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call' 
actionpack (5.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call' 
activerecord (5.0.1) lib/active_record/migration.rb:553:in `call' 
actionpack (5.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call' 
activesupport (5.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__' 
activesupport (5.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks' 
activesupport (5.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks' 
actionpack (5.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call' 
actionpack (5.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call' 
actionpack (5.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call' 
actionpack (5.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49: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:20: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' 
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13: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' 
/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request' 
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:152:in `accept_and_process_next_request' 
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:113:in `main_loop' 
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:416:in `block (3 levels) in start_threads' 
/usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception' 
    Rendering /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout 
    Rendering /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb 
    Rendered /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (3.1ms) 
    Rendering /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb 
    Rendered /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.3ms) 
    Rendering /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb 
    Rendered /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.8ms) 
    Rendered /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (20.3ms) 
Started POST "/webhook" for 66.220.152.184 at 2017-02-20 04:02:49 +0000 
Cannot render console from 66.220.152.184! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255 

LoadError (Unable to autoload constant ApplicationController, expected /home/ubuntu/line/app/controllers/application_controller.rb to define it): 

app/controllers/messenger_controller.rb:3:in `<top (required)>' 
    Rendering /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout 
    Rendering /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb 
    Rendered /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (3.2ms) 
    Rendering /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb 
    Rendered /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.6ms) 
    Rendering /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb 
    Rendered /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.1ms) 
    Rendered /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (22.7ms) 
+0

was waren die Änderungen ... können Sie uns sagen? – Milind

+0

Nur ein paar Zeilen CSS und HTML nichts, was ganze App beeinflussen kann. Ich habe versucht, Änderungen zu ändern und immer noch den gleichen Fehler – liborza

+0

zeigen Sie mir Ihre routes.rb bitte – Milind

Antwort

0

Ich benutze C9 und SSH für AWS-Server .. Das Problem war in C9, weil es die Dateien nicht gut synchronisiert, so, wenn ich die Datei schließe und öffnen Sie es erneut, die Dateien waren leer.

Falls jemand C9 benutzt und das selbe Problem hat wie ich.

0

Dies ist keine Routen Problem. Das Problem ist ein Problem mit konstanter Auflösung (plus Autoloading), weil es sagt, dass es die HomeController Klasse in home_controller.rb nicht findet, trotz der Tatsache, dass es dort definiert ist.

Versuchen Sie, den Serverprozess neu zu starten. Obwohl Autoloading alle Änderungen an Klassen behandeln sollte, habe ich manchmal gesehen, dass es fehlschlägt. Ich habe auch das gleiche Problem mit dem spring Preloader passiert.

Wenn dies nicht funktioniert, können Sie uns wissen lassen, ob Sie eine IDE verwenden und was passiert, wenn Sie versuchen, mit der Klasse ApplicationController innerhalb der Konsole zu interagieren.

+1

Okay, ich werde versuchen, dass morgen weil Ich habe gerade das Büro verlassen. Aber danke für die Erklärung und Details zu dem Thema. – liborza

+0

Ich habe versucht, Server neu zu starten, aber ich bekomme immer noch die gleichen Fehler, mit NGINX und RMV für Schienen App. Btw .. was meinst du über 'Frühling' sollte ich versuchen, dieses Juwel neu zu installieren? – liborza

+0

@ LiborZahrádka Ich glaube nicht, dass es ein "Spring" -Gemeinproblem sein wird, es läuft nicht in der Entwicklung, denke ich nicht. IDE ist wahrscheinlich auch irrelevant. Kannst du 'rails console' aufmachen und' ApplicationController' aufrufen und sehen was passiert? –

0

Wie Sie erwähnt, dass alle Controller diesen Fehler geben, weil einige Änderung überprüfen Sie bitte in der Datei application.rb und fügen Sie diese Zeile oder ein ähnlich wie unter

config.autoload_paths += %W(#{config.root}/controllers) 

Die oben sein kann in Ihrem application.rb Ihre bekommen diese Fehler, der es verhindert automatisches Laden aller Controller

+0

Ich versuchte das in 'application.rb' aber nichts ändere – liborza

+0

@Umar, das hätte nicht geholfen; Es wurde versucht, den richtigen Pfad automatisch zu laden. Ich glaube, dass ein 'autoload_path' keinen standardmäßigen undefinierten konstanten Fehler erzeugt. –

Verwandte Themen