我今天开始学习Rails
。我正在关注在线教程。我收到一个错误。在教程中,只要有错误,就会在浏览器中显示错误的原因。但我只收到此消息:
We're sorry, but something went wrong. If you are the application owner check the logs for more information.
如何使Rails
像error
文件中的Django
一样显示实际的debug = True
来显示错误?
development.rb
settings.py
日志
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
config.ru
/usr/lib/ruby/vendor_ruby/rails/app_rails_loader.rb:39: warning: Insecure world writable dir /usr/lib/jvm/java-8-openjdk-amd64/bin in PATH, mode 040777
Array values in the parameter to `Gem.paths=` are deprecated.
Please use a String or nil.
An Array ({"GEM_PATH"=>["/var/lib/gems/2.5.0", "/home/laxman/.gem/ruby/2.5.0", "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.5.0", "/usr/share/rubygems-integration/2.5.0", "/usr/share/rubygems-integration/all"]}) was passed in from bin/rails:3:in `load'
Warning: Running `gem pristine --all` to regenerate your installed gemspecs (and deleting then reinstalling your bundle if you use bundle --path) will improve the startup performance of Spring.
/usr/lib/ruby/vendor_ruby/sprockets/digest_utils.rb:47: warning: constant ::Fixnum is deprecated
/usr/lib/ruby/vendor_ruby/sprockets/digest_utils.rb:51: warning: constant ::Bignum is deprecated
/usr/lib/ruby/vendor_ruby/sprockets/processor_utils.rb:110: warning: constant ::Fixnum is deprecated
/usr/lib/ruby/vendor_ruby/sprockets/processor_utils.rb:111: warning: constant ::Bignum is deprecated
=> Booting WEBrick
=> Rails 4.2.10 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2019-04-27 16:46:06] INFO WEBrick 1.4.2
[2019-04-27 16:46:06] INFO ruby 2.5.1 (2018-03-29) [x86_64-linux-gnu]
[2019-04-27 16:46:06] INFO WEBrick::HTTPServer#start: pid=2467 port=3000
Started GET "/" for 127.0.0.1 at 2019-04-27 16:46:10 +0530
ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
application.rb
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
答案 0 :(得分:1)
在查看full application您posted之后,我能够重现该问题。
在其他StackOverflow帖子中,这个问题是reported before,但我将在这里重复:
您需要将web-console
宝石更新为版本3.0+
;尤其是由于this bug fix在代理后面的VM /容器中运行Rails服务器。
换句话说,您需要将this line in your Gemfile
更新为:
gem 'web-console', '~> 3.0'
然后运行bundle install
。
在相关说明中,您似乎在项目中使用了许多过时的软件版本(例如,rails版本4.2)。通常可以通过使依赖项保持最新状态来缓解此类问题。