Reputation: 1139
I have started to learn Rails
today. I am following an online tutorial. I am getting an error. In the tutorial whenever there is an error, the reason for the error is displayed in the browser. But I just get this message:
We're sorry, but something went wrong. If you are the application owner check the logs for more information.
How can I make Rails
to show display the actual error
like how Django
displays the error when debug = True
in settings.py
file?
development.rb
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
log
/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"
config.ru
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Proj
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
end
end
Upvotes: 4
Views: 1749
Reputation: 28305
After reviewing the full application you posted, I was able to reproduce the problem.
This issue has been reported before, in other StackOverflow posts, but I'll repeat it here:
You need to update the web-console
gem to version 3.0+
; in particular due to this bug fix for running the rails server in a VM/container behind a proxy.
In other words, you need to update this line in your Gemfile
to:
gem 'web-console', '~> 3.0'
and then run bundle install
.
On a related note, you seem to be using many outdated software versions in your project (e.g. rails version 4.2). Issues like this can usually be mitigated by keeping your dependencies up-to-date.
Upvotes: 2