Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 131775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:09:30+00:00 2026-05-11T06:09:30+00:00

Every time I try to run any class from my rails 2.2 app’s lib

  • 0

Every time I try to run any class from my rails 2.2 app’s lib directory using ‘script/runner -e production ClassName.run’ I get the following error:

/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/runner.rb:47:   /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:89:in `const_missing': uninitialized constant ClassName (NameError)' 

For some reason I don’t get this error when I run it as test instead of production, and everything works fine.

O yeah run is a class method i.e. def self.run .... end

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T06:09:31+00:00Added an answer on May 11, 2026 at 6:09 am

    That error occurs when ruby can’t find a Class or Module. I’d start out by:

    1. Checking gem dependencies (are they same for all environments?)
    2. Search your code for anything that defines ClassName, particularly Modules, Classes and plugins.
    3. disable each of your plugins in dev, does any plugin suddenly cause that error?
    4. if the code is in a lib add the lib require statement to your production.rb to force the lib to be loaded in production.

    Hope that helps.

    update Just to summarise the comments it was option 4.

    Unless you only want to load the lib in production you should think about making sure all environments load the lib by doing one of the following:

    1. Create a rails initializer (a .rb file under config/initializers) with the require in it
    2. Add the path to the lib in config/environment.rb by enabling and modifying the config.load_paths variable.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 243k
  • Answers 243k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The best way I can think of is to use… May 13, 2026 at 7:52 am
  • Editorial Team
    Editorial Team added an answer You'd want to use goroutines and synchronize access to your… May 13, 2026 at 7:52 am
  • Editorial Team
    Editorial Team added an answer If you want to solve it recursively, an easier approach… May 13, 2026 at 7:52 am

Related Questions

Every time I try to run any class from my rails 2.2 app's lib
For my project I am using the integrated Visual Studio unit-testing framework but I
Is there any way to capture the MouseDown even from the .NET 2.0 TextBox
I use EntitySpaces for all of my Database related coding. As a sole developer
I need to create an instance of an object and the type of that

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.