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 6015203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:48:09+00:00 2026-05-23T02:48:09+00:00

I was hoping to make a Rails app usable both as an Engine and

  • 0

I was hoping to make a Rails app usable both as an Engine and as a standalone Application.

Specifically, I have a nascent app which I’d like to plug in to a customer’s site, but ideally, I’d like to just as easily use the app as a standalone system. However, if config/environments/*.rb exist in the enginified version of my app, I get an Uninitialized Constant error at the time the app that I’m having take a dependency on my engine starts up; Rails complains that the MyEngineModule::Application constant can’t be found in development.rb, which I think is simply a load order issue, since this does NOT occur when I run the app standalone. If I delete development.rb, the original initializers that reference my MyEngineModule::Application complain, so then I tried to delete those, and all is well.

Great, except that the original app doesn’t work, since its configuration is gone.

Is there some tweak I can make to the initialization load order (or load paths, in the Engine < Rails::Engine class definition) that would prevent the original configs and initializers from being loaded when in an engine context, and allow me to leave them in place for the app context?

The simpler answer is probably this, but I’m feeling stubborn, and would like to know what it would take to make my original goal possible:

  • extract the code for MyEngine into an engine, remove the config/environments/* files and config/initializers/* files, and make the client app depend on this.
  • Make a “new” minimalist app depend on MyEngine, and move the environment files and initializers to NewApp.

Assuming I feel some unnatural compulsion to keep my original application runnable as it was, if I want to prevent the “engine” from loading the “application” configuration, what’s the best way to handle that? I presume this is only really a problem during development, because I can prevent the environments/*.rb files from being pulled into the gem itself, but I like being able to test locally while I’m developing the engine and its client app.

  • 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-23T02:48:09+00:00Added an answer on May 23, 2026 at 2:48 am

    Continuing my tradition of answering my own esoteric questions, it seems like one passable alternative is to include a guard clause in the engine’s environments/*.rb and the initializers that goes something like this:

    if defined? CuteEngine::Application
      CuteEngine::Application.configure do
        config.whatever = something
      end
    end
    

    This gets around the problem of having two Rails::Application objects at a relatively small cost. Not very happy about it, but I’ll live.

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

Sidebar

Related Questions

I was hoping to make an app which dimmed the soft buttons to dots
My application has a userspace which used to be accessed by a url like
I have a standard many-to-many relationship between users and roles in my Rails app:
I am building an iPhone app where I would like authenticate with a rails
In my Ruby on Rails app, I have a User table and a Foo
I'm hoping to make an app that streams live video that has a view
I'm refatoring a home-grown DAO container, hoping to make the class generic. It internally
Hoping some learned Rails developers here can recommend an existing Ruby on Rails plugin
Hoping that using something like this demo it is possible to drag items within
Hoping someone can clear this up for me. Let's say I have 2 globals:

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.