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

  • SEARCH
  • Home
  • 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 7170689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:15:45+00:00 2026-05-28T15:15:45+00:00

I have these lines of code that I use as a Factory to create

  • 0

I have these lines of code that I use as a Factory to create objects:

class ServiceProcessor    
  def self.create(service, logger)
    classified_name = service.name.to_s.split('_').collect! { |w| w }.join << "Processor"
    logger.warn "Creating service proc, classified name: #{classified_name}"
    service_proc = Object.const_get(classified_name).new
    ... check respond_to etc. 
    return service_proc

The first line might be odd, it needs to be refactored. I can use these lines to create various Processors:

 class AlphaProcessor < ServiceProcessor
 class BetaProcessor < ServiceProcessor
 etc...

So these processors can be created in my specs and via the console. They can be created in rake as well — but only some of them. Two of them are failing:

WARN 2012-01-27 08:54:18 -0800 (25626) Creating service proc, 
 classified name: AlphaProcessor 
ERROR 2012-01-27 08:54:18 -0800 (25626) 
 Failed for service #<Service _id: 4f203c171d41c83b3b000003, _type: nil, 
 deleted_at: nil, name: "Alpha", enabled: true> 
ERROR 2012-01-27 08:54:18 
 -0800 (25626) Exception: uninitialized constant AlphaProcessor ERROR 
 2012-01-27 08:54:18 -0800 (25626) Backtrace: 
 ["/mnt/hgfs/kodiak/lib/service_processors/_service_processor.rb:33:in 
 `const_get'", 
 "/mnt/hgfs/kodiak/lib/service_processors/_service_processor.rb:33:in 
 `create'", "/mnt/hgfs/kodiak/lib/update_engine.rb:28:in `block in 
 update_all'", 

So the question is, how should I go about figuring out why these two (out of 9) would fail, but only in Rake? I can see that Rake and the Console are loading the same environment (a few puts in the environment.rb), so I doubt that’s it. I’m stumped on what could be causing this or where to look.

  • 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. Editorial Team
    Editorial Team
    2026-05-28T15:15:46+00:00Added an answer on May 28, 2026 at 3:15 pm

    Have you tried adding a Kernel#require to the top of your rake file to load the proper classes? Also, how are you defining the rake task? I’ve been able to do this for pulling in my class constants:

    task :my_task => :environment do
      ...
    end
    

    Also, check your filenames. Make sure that a class named “AlphaBravoTangoProcessor” is in a file named ‘alpha_bravo_tango_processor.rb’, not a file named ‘alphabravotango_processor.rb’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a txt file that created in notepad , containing these lines for
I'd like to have these lines of code executed on server startup (both development
I have these two lines in my code: TCHAR String[400] = {0}; SendMessageW(hwnd, WM_GETTEXT,sizeof(String),
Say I have a singleton-ish, factory-ish, reflection-ish class that receives some input, and spits
Hello there when I try and use these two lines of code in my
I have these lines in my ~/.inputrc : set editing-mode vi set keymap vi
I have these (sample) lines in a HTML-file: test.ABC.test test.ABCD.test test.ABCE.test And this Ant
I have defined a custom file type with these lines: syn region SubSubtitle start=+=+
How can I have each of these a elements break on to new lines,
I have links like these that I want to change: mypage.com?page=missions&id=5 mypage.com?page=hello I tried

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.