0

I'm trying to run the usual rails commands (rails s, rails g, rails c, etc) and I'm getting errors (because I'm migrating from MRI ruby and postgres to jruby and neo4j), which would be fine if only there was a stack trace.

It looks like this:

$ rails s
NameError: uninitialized constant Authorization::ActiveRecord

I'm expecting errors like this because Neo4j doesn't use ActiveRecord and it no longer exists, but I really need to see which file is calling ActiveRecord so I can fix this. But nothing I've found from google or tried in the code has brought the backtrace back to me. ;_;

My config/application.rb is:

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

And my config/environments/development.rb is:

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

I'm not aware of any other files that might effect the logger/backtrace situation. I'd include more but this feels like such a general problem I'm really not sure what to include.

Update: I'm pretty sure this question is a duplicate of here (althought I'm trying to get it working in any environment).

Community
  • 1
  • 1
Dave
  • 1,031
  • 1
  • 8
  • 23
  • I've found a "work around" which works because other things also fail such as the 'rake -T' command. As I can run rake with the '--trace' flag I can force a trace in there... Although it won't do me any good when looking for errors while the server is running. – Dave Jun 27 '12 at 04:34
  • Working on this some more I'm finding the trend is that errors occuring inside of gems are not including backtraces unless I run with 'rake -T --trace'. – Dave Jun 27 '12 at 05:41

0 Answers0