0

通常のrailsコマンド(rails s、rails g、rails cなど)を実行しようとしていますが、エラーが発生します(MRIrubyからpostgresからjrubyとneo4jに移行しているため)。スタックトレースだけがありました。

次のようになります。

$ rails s
NameError: uninitialized constant Authorization::ActiveRecord

Neo4jはActiveRecordを使用せず、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/environment/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

ロガー/バックトレースの状況に影響を与える可能性のある他のファイルを認識していません。もっと含めたいのですが、これはとても一般的な問題のように感じます。何を含めるべきか本当にわかりません。

更新:この質問はここと重複していると確信しています(どのような環境でも機能させようとしていると思います)。

4

0 に答える 0