나는 성공적으로 내 로컬 시스템에 기반 응용 프로그램을 가지고 있지만, Heroku가 배포하거나 rails server -e production
수율로 실행하면레일 응용 프로그램이 충돌 할 때 config.eager_load = 사실
=> Rails 4.0.0 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/nmradar/Documents/old-manager/app/controllers/registrations_controller.rb:2:in `<top (required)>': uninitialized constant Users (NameError)
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/engine.rb:465:in `block (2 levels) in eager_load!'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/engine.rb:464:in `each'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/engine.rb:464:in `block in eager_load!'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/engine.rb:462:in `each'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/engine.rb:462:in `eager_load!'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/engine.rb:347:in `eager_load!'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `each'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/nmradar/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /home/nmradar/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /home/nmradar/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /home/nmradar/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /home/nmradar/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /home/nmradar/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /home/nmradar/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/nmradar/Documents/old-manager/config/environment.rb:5:in `<top (required)>'
from /home/nmradar/Documents/old-manager/config.ru:3:in `block in <main>'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /home/nmradar/Documents/old-manager/config.ru:in `new'
from /home/nmradar/Documents/old-manager/config.ru:in `<main>'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands/server.rb:48:in `app'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands/server.rb:75:in `start'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:78:in `block in <top (required)>'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /home/nmradar/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
내 environment.rb에이
입니다# Load the Rails application.
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
OldManager::Application.initialize!
내가을 전환하는 경우 registrations_controller.rb는
# controllers/users/registrations_controller.rb
class Users::RegistrationsController < Devise::RegistrationsController
before_filter :configure_permitted_parameters
protected
# my custom fields are :name
devise_parameter_sanitizer.for(:sign_up) do |u|
u.permit(:name, :major, :email, :password, :password_confirmation)
end
devise_parameter_sanitizer.for(:account_update) do |u|
u.permit(:name, :email, :password, :password_confirmation, :current_password)
end
end
입니다이 config.eager_load = false
이고 내 config/environment/production.rb
이면 성공적으로 서버를 시작하고 내 응용 프로그램을 사용할 수 있습니다. eager_load
은 프로덕션 환경에 바람직한 기능이라고 가정합니다. 그렇지 않으면 기본적으로 활성화되지 않습니다. 그렇다면 eager_load
을 사용하여 앱을 실행할 수 있도록하려면 어떻게해야합니까? 아니면 내 서버가 서버를 중단시키는 원인에 대해 자세히 알아 보려면 어떻게해야합니까? 이 파일을 찾으려면 다른 파일이 필요하면 알려주십시오.
레일 4 및 루비 2.0.0을 실행 중입니다.
어떤 조언을 주셔서 감사합니다!
당신은 심지어 오류 메시지를 읽을나요? 열망하는로드는 문제가되지 않습니다. –
고정 된 @ user1483188을 얻었습니까? eager_load = true로 만들 때 동일한 문제가 발생 했습니까? 서버 크래시가 발생했습니다 (오류가 아니라는 점을 언급 한 오류가 아닙니다), 오류 발생시에만 서버를 실행할 수있었습니다. . 오류를 해결하면 알려주세요 – ratnakar