我正在尝试运行通常的 rails 命令(rails s、rails g、rails c 等),但出现错误(因为我正在从 MRI ruby 和 postgres 迁移到 jruby 和 neo4j),如果只有一个堆栈跟踪。
它看起来像这样:
$ rails s
NameError: uninitialized constant Authorization::ActiveRecord
我期待这样的错误,因为 Neo4j 不使用 ActiveRecord 并且它不再存在,但我真的需要查看哪个文件正在调用 ActiveRecord,以便我可以解决这个问题。但是我从谷歌发现或在代码中尝试过的任何东西都没有将回溯带回给我。;_;
我的 config/application.rb 是:
require File.expand_path('../boot', __FILE__)
require 'action_controller/railtie'
require 'action_mailer/railtie'
require 'active_resource/railtie'
require 'rails/test_unit/railtie'
require 'sprockets/railtie'
require 'neo4j'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require *Rails.groups(:assets => %w(development test))
# If you want your assets lazily compiled in pro duction, use this line
# Bundler.require(:default, :assets, Rails.env)
end
module MyApp
class Application < Rails::Application
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, chanmge this if you want to expire all your assets
config.assets.version = '1.1'
# 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.
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
# this was done to load all modules in lib
# following directions at: https://stackoverflow.com/questions/3356742/best-way-to-load-module-class-from-lib-folder-in-rails-3/3962321#3962321
config.autoload_paths += Dir["#{config.root}/lib/**/"]
#for rails-ckeditor
config.autoload_paths += %W( #{config.root}/app/models/ckeditor )
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# 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
# JavaScript files you want as :defaults (application.js is always included).
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
end
end
我的 config/environments/development.rb 是:
MyApp::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 webserver when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
#config.action_view.debug_rjs = true $ turn off for rails 3.1
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
#Devise wants this:
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
config.log_level = :debug
# Do not compress assets
config.assets.compress = false
# Expand the lines which load the assets
config.assets.debug = true
end
我不知道任何其他可能影响记录器/回溯情况的文件。我会包括更多,但这感觉像是一个普遍的问题,我真的不确定要包括什么。
更新:我很确定这个问题是这里的重复(尽管我试图让它在任何环境中工作)。